@salesforce/webapp-template-feature-react-authentication-experimental 1.18.0 → 1.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CHANGELOG.md +16 -0
- package/dist/force-app/main/default/classes/WebAppChangePassword.cls +4 -4
- package/dist/force-app/main/default/classes/WebAppForgotPassword.cls +71 -0
- package/dist/force-app/main/default/classes/WebAppForgotPassword.cls-meta.xml +5 -0
- package/dist/force-app/main/default/webapplications/feature-react-authentication/src/pages/ForgotPassword.tsx +2 -2
- package/dist/package.json +1 -1
- package/package.json +3 -3
package/dist/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.19.1](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.19.0...v1.19.1) (2026-02-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [1.19.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.18.0...v1.19.0) (2026-02-10)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
# [1.18.0](https://github.com/salesforce-experience-platform-emu/webapps/compare/v1.17.1...v1.18.0) (2026-02-10)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @salesforce/webapp-template-base-sfdx-project-experimental
|
|
@@ -32,12 +32,12 @@ global with sharing class WebAppChangePassword {
|
|
|
32
32
|
// System.SecurityException is a user error but treat others as system errors
|
|
33
33
|
if (ex instanceof System.SecurityException) {
|
|
34
34
|
RestContext.response.statusCode = 400;
|
|
35
|
-
return new ErrorPasswordChangeResponse(ex.getMessage());
|
|
35
|
+
return new ErrorPasswordChangeResponse(ex.getMessage());
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
// Logs are only captured if a Trace Flag is active for the user
|
|
39
39
|
WebAppAuthUtils.debugLog(ex, LoggingLevel.ERROR);
|
|
40
|
-
|
|
40
|
+
|
|
41
41
|
RestContext.response.statusCode = 500;
|
|
42
42
|
return new ErrorPasswordChangeResponse('Password change failed');
|
|
43
43
|
}
|
|
@@ -47,7 +47,7 @@ global with sharing class WebAppChangePassword {
|
|
|
47
47
|
global abstract class PasswordChangeResponse {
|
|
48
48
|
|
|
49
49
|
/** Success or failure of the password change operation */
|
|
50
|
-
|
|
50
|
+
protected final Boolean success;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
/** Success response for password change. */
|
|
@@ -63,7 +63,7 @@ global with sharing class WebAppChangePassword {
|
|
|
63
63
|
global class ErrorPasswordChangeResponse extends PasswordChangeResponse {
|
|
64
64
|
|
|
65
65
|
/** Error message describing the failure reason */
|
|
66
|
-
private String error;
|
|
66
|
+
private final String error;
|
|
67
67
|
|
|
68
68
|
/**
|
|
69
69
|
* Constructs an error response with the specified error message.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* REST endpoint for Web Applications forgot password functionality.
|
|
3
|
+
*
|
|
4
|
+
* Endpoint: POST /services/apexrest/auth/forgot-password
|
|
5
|
+
*
|
|
6
|
+
* Sends a password reset email to the user's registered email address.
|
|
7
|
+
*/
|
|
8
|
+
@RestResource(urlMapping='/auth/forgot-password')
|
|
9
|
+
global with sharing class WebAppForgotPassword {
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Initiates the forgot password process by sending a reset email.
|
|
13
|
+
* @param email User's email address (used as username).
|
|
14
|
+
* @return ForgotPasswordResponse with success status or error message.
|
|
15
|
+
*/
|
|
16
|
+
@HttpPost
|
|
17
|
+
global static ForgotPasswordResponse forgotPassword(String username) {
|
|
18
|
+
try {
|
|
19
|
+
username = username.trim().toLowerCase();
|
|
20
|
+
|
|
21
|
+
if (String.isBlank(username)) {
|
|
22
|
+
RestContext.response.statusCode = 400;
|
|
23
|
+
return new ErrorForgotPasswordResponse('Username is required.');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// [Dev Note] This will send a password reset link to the user's email address
|
|
27
|
+
// if the username exists.
|
|
28
|
+
Site.forgotPassword(username);
|
|
29
|
+
|
|
30
|
+
return new SuccessForgotPasswordResponse();
|
|
31
|
+
} catch (Exception ex) {
|
|
32
|
+
// Logs are only captured if a Trace Flag is active for the user
|
|
33
|
+
WebAppAuthUtils.debugLog(ex, LoggingLevel.ERROR);
|
|
34
|
+
|
|
35
|
+
RestContext.response.statusCode = 500;
|
|
36
|
+
return new ErrorForgotPasswordResponse('Could not send password reset link.');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Base response class for forgot password operations. */
|
|
41
|
+
global abstract class ForgotPasswordResponse {
|
|
42
|
+
|
|
43
|
+
/** Success or failure of the forgot password operation */
|
|
44
|
+
protected final Boolean success;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Success response for forgot password. */
|
|
48
|
+
global class SuccessForgotPasswordResponse extends ForgotPasswordResponse {
|
|
49
|
+
|
|
50
|
+
/** Constructs a success response. */
|
|
51
|
+
private SuccessForgotPasswordResponse() {
|
|
52
|
+
this.success = true;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Error response for forgot password. */
|
|
57
|
+
global class ErrorForgotPasswordResponse extends ForgotPasswordResponse {
|
|
58
|
+
|
|
59
|
+
/** Error message describing the failure reason */
|
|
60
|
+
private final String error;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Constructs an error response with the specified error message.
|
|
64
|
+
* @param error The error message to return to the client.
|
|
65
|
+
*/
|
|
66
|
+
private ErrorForgotPasswordResponse(String error) {
|
|
67
|
+
this.success = false;
|
|
68
|
+
this.error = error;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
@@ -24,7 +24,7 @@ export default function ForgotPassword() {
|
|
|
24
24
|
try {
|
|
25
25
|
// [Dev Note] Custom Apex Endpoint: /auth/forgot-password
|
|
26
26
|
// You must ensure this Apex class exists in your org
|
|
27
|
-
const response = await baseClient.post("/services/apexrest/auth/forgot-password", {
|
|
27
|
+
const response = await baseClient.post("/sfdcapi/services/apexrest/auth/forgot-password", {
|
|
28
28
|
username: value.username.trim(),
|
|
29
29
|
});
|
|
30
30
|
await handleApiResponse(response, "Failed to send reset link");
|
|
@@ -47,7 +47,7 @@ export default function ForgotPassword() {
|
|
|
47
47
|
success &&
|
|
48
48
|
"If that username exists in our system, you will receive a reset link shortly."
|
|
49
49
|
}
|
|
50
|
-
submit={{ text: "Send Reset Link", loadingText: "Sending…" }}
|
|
50
|
+
submit={{ text: "Send Reset Link", loadingText: "Sending…", disabled: success }}
|
|
51
51
|
footer={{ text: "Remember your password?", link: ROUTES.LOGIN.PATH, linkText: "Sign in" }}
|
|
52
52
|
>
|
|
53
53
|
<form.AppField name="username">
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforce/webapp-template-feature-react-authentication-experimental",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.1",
|
|
4
4
|
"description": "Authentication feature for web applications",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"watch": "npx tsx ../../cli/src/index.ts watch-patches packages/template/feature/feature-react-authentication packages/template/base-app/base-react-app packages/template/feature/feature-react-authentication/dist"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@salesforce/webapp-experimental": "^1.
|
|
22
|
+
"@salesforce/webapp-experimental": "^1.19.1",
|
|
23
23
|
"@tanstack/react-form": "^1.27.7",
|
|
24
24
|
"@types/react": "^19.2.7",
|
|
25
25
|
"@types/react-dom": "^19.2.3",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"react-router": "^7.10.1",
|
|
28
28
|
"vite": "^7.3.1"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "027a134d5ab27216a4f1a05e2f09efdb28356385"
|
|
31
31
|
}
|