@alore/auth-react-sdk 1.1.0-alpha.10 → 1.1.0-alpha.11
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/utils/AloreAuth.d.ts +3 -1
- package/dist/utils/AloreAuth.js +13 -7
- package/package.json +1 -1
|
@@ -34,8 +34,9 @@ export declare class AloreAuth {
|
|
|
34
34
|
confirmPassword: (context: AuthMachineContext, event: {
|
|
35
35
|
type: 'CONFIRM_PASSWORD';
|
|
36
36
|
payload: {
|
|
37
|
-
|
|
37
|
+
salt: string;
|
|
38
38
|
passwordHash: string;
|
|
39
|
+
token: string;
|
|
39
40
|
};
|
|
40
41
|
}) => Promise<{}>;
|
|
41
42
|
sendConfirmationEmail: (context: AuthMachineContext, event: {
|
|
@@ -64,6 +65,7 @@ export declare class AloreAuth {
|
|
|
64
65
|
type: 'SEND_CODE';
|
|
65
66
|
payload: {
|
|
66
67
|
email: string;
|
|
68
|
+
locale?: string;
|
|
67
69
|
};
|
|
68
70
|
}) => Promise<{}>;
|
|
69
71
|
verifyLogin: (context: AuthMachineContext, event: {
|
package/dist/utils/AloreAuth.js
CHANGED
|
@@ -76,15 +76,16 @@ export class AloreAuth {
|
|
|
76
76
|
yield this.throwParsedResponseError(response);
|
|
77
77
|
}),
|
|
78
78
|
confirmPassword: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
79
|
-
const {
|
|
80
|
-
const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/password
|
|
79
|
+
const { salt, passwordHash, token } = event.payload;
|
|
80
|
+
const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/reset-password`, {
|
|
81
81
|
method: 'POST',
|
|
82
82
|
headers: {
|
|
83
83
|
'Content-Type': 'application/json',
|
|
84
84
|
},
|
|
85
85
|
body: JSON.stringify({
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
token,
|
|
87
|
+
salt,
|
|
88
|
+
newPassword: passwordHash,
|
|
88
89
|
}),
|
|
89
90
|
});
|
|
90
91
|
if (!response.ok)
|
|
@@ -120,8 +121,13 @@ export class AloreAuth {
|
|
|
120
121
|
yield this.throwParsedResponseError(response);
|
|
121
122
|
}),
|
|
122
123
|
sendCode: (context, event) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
-
const { email } = event.payload;
|
|
124
|
-
const
|
|
124
|
+
const { email, locale } = event.payload;
|
|
125
|
+
const searchParams = new URLSearchParams();
|
|
126
|
+
const url = '/auth/v1/request-password-reset';
|
|
127
|
+
if (locale) {
|
|
128
|
+
searchParams.append('locale', locale);
|
|
129
|
+
}
|
|
130
|
+
const response = yield this.fetchWithProgressiveBackoff(searchParams.size > 0 ? `${url}?${searchParams.toString()}` : url, {
|
|
125
131
|
method: 'POST',
|
|
126
132
|
headers: {
|
|
127
133
|
'Content-Type': 'application/json',
|
|
@@ -577,7 +583,7 @@ export class AloreAuth {
|
|
|
577
583
|
const parsed = yield this.parseErrorResponse(response);
|
|
578
584
|
// Normalize well-known auth errors for consistent UI handling
|
|
579
585
|
let normalizedMessage = parsed.message || 'Request failed';
|
|
580
|
-
if (parsed.status === 401) {
|
|
586
|
+
if (parsed.status === 401 && parsed.message !== 'INVALID_SESSION') {
|
|
581
587
|
normalizedMessage = 'INVALID_CREDENTIALS';
|
|
582
588
|
}
|
|
583
589
|
else if (parsed.status === 403 && parsed.message === 'EMAIL_NOT_ALLOWED') {
|