@alore/auth-react-sdk
Advanced tools
@@ -37,4 +37,5 @@ import type { AuthMachineContext, AuthProviderConfig, FetchWithProgressiveBackoffConfig, ForgeData } from '../types'; | ||
| payload: { | ||
| email: string; | ||
| salt: string; | ||
| passwordHash: string; | ||
| token: string; | ||
| }; | ||
@@ -68,2 +69,3 @@ }) => Promise<{}>; | ||
| email: string; | ||
| locale?: string; | ||
| }; | ||
@@ -70,0 +72,0 @@ }) => Promise<{}>; |
@@ -79,4 +79,4 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
| confirmPassword: (context, event) => __awaiter(this, void 0, void 0, function* () { | ||
| const { email, passwordHash } = event.payload; | ||
| const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/password-creation`, { | ||
| const { salt, passwordHash, token } = event.payload; | ||
| const response = yield this.fetchWithProgressiveBackoff(`/auth/v1/reset-password`, { | ||
| method: 'POST', | ||
@@ -87,4 +87,5 @@ headers: { | ||
| body: JSON.stringify({ | ||
| email, | ||
| newPasswordHash: passwordHash, | ||
| token, | ||
| salt, | ||
| newPassword: passwordHash, | ||
| }), | ||
@@ -125,4 +126,9 @@ }); | ||
| sendCode: (context, event) => __awaiter(this, void 0, void 0, function* () { | ||
| const { email } = event.payload; | ||
| const response = yield this.fetchWithProgressiveBackoff(`/reset-password`, { | ||
| const { email, locale } = event.payload; | ||
| const searchParams = new URLSearchParams(); | ||
| const url = '/auth/v1/request-password-reset'; | ||
| if (locale) { | ||
| searchParams.append('locale', locale); | ||
| } | ||
| const response = yield this.fetchWithProgressiveBackoff(searchParams.size > 0 ? `${url}?${searchParams.toString()}` : url, { | ||
| method: 'POST', | ||
@@ -583,3 +589,3 @@ headers: { | ||
| let normalizedMessage = parsed.message || 'Request failed'; | ||
| if (parsed.status === 401) { | ||
| if (parsed.status === 401 && parsed.message !== 'INVALID_SESSION') { | ||
| normalizedMessage = 'INVALID_CREDENTIALS'; | ||
@@ -586,0 +592,0 @@ } |
+1
-1
| { | ||
| "name": "@alore/auth-react-sdk", | ||
| "version": "1.1.0-alpha.10", | ||
| "version": "1.1.0-alpha.11", | ||
| "repository": "https://github.com/0xCarbon/alore-js", | ||
@@ -5,0 +5,0 @@ "description": "SDK for Alore Auth", |
75441
0.56%1100
0.73%