Skip to content

Commit b812a37

Browse files
authored
Release v1.34.1 (#286)
1 parent 01fd0d7 commit b812a37

File tree

6 files changed

+821
-451
lines changed

6 files changed

+821
-451
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10-
## [1.34.0] - 2025-05-13
10+
## [1.34.1] - 2025-05-15
11+
12+
### Fixed
13+
14+
- Reset password with phone number should send phone number value in payload
1115

1216
### Added
17+
1318
- Allow to trust device during mfa credential registration
1419

1520
### Fixed
@@ -609,6 +614,8 @@ First version of the SDK Web UI.
609614

610615
[Unreleased]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.34.0...HEAD
611616

617+
[1.34.1]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.34.0...v1.34.1
618+
612619
[1.34.0]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.33.2...v1.34.0
613620

614621
[1.33.2]: https://github.com/ReachFive/identity-web-ui-sdk/compare/v1.33.1...v1.33.2

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@reachfive/identity-ui",
3-
"version": "1.34.0",
3+
"version": "1.34.1",
44
"description": "ReachFive Identity Web UI SDK",
55
"author": "ReachFive",
66
"repository": {

src/widgets/auth/views/forgotPasswordViewComponent.tsx

Lines changed: 125 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
1-
import React, { useCallback, useLayoutEffect, useState } from 'react';
1+
import React, { useCallback, useLayoutEffect } from 'react'
22

33
import { isAppError } from '../../../helpers/errors'
44

5-
import { email } from '../../../core/validation';
6-
import { Heading, Intro, Info, Link, Alternative } from '../../../components/miscComponent';
5+
import {
6+
Alternative,
7+
Heading,
8+
Info,
9+
Intro,
10+
Link,
11+
} from '../../../components/miscComponent'
12+
import { email } from '../../../core/validation'
713

8-
import { createForm, FormContext } from '../../../components/form/formComponent';
9-
import phoneNumberField, { type PhoneNumberOptions } from '../../../components/form/fields/phoneNumberField';
10-
import { simpleField } from '../../../components/form/fields/simpleField';
11-
import ReCaptcha, {importGoogleRecaptchaScript} from '../../../components/reCaptcha';
14+
import phoneNumberField, {
15+
type PhoneNumberOptions,
16+
} from '../../../components/form/fields/phoneNumberField'
17+
import { simpleField } from '../../../components/form/fields/simpleField'
18+
import { createForm, FormContext } from '../../../components/form/formComponent'
19+
import ReCaptcha, {
20+
importGoogleRecaptchaScript,
21+
} from '../../../components/reCaptcha'
1222

23+
import { InitialScreen } from '../../../../constants.ts'
24+
import { DefaultButton } from '../../../components/form/buttonComponent.tsx'
25+
import passwordField from '../../../components/form/fields/passwordField.tsx'
26+
import simplePasswordField from '../../../components/form/fields/simplePasswordField'
27+
import { useConfig } from '../../../contexts/config.tsx'
1328
import { useI18n } from '../../../contexts/i18n'
14-
import { useRouting } from '../../../contexts/routing';
15-
import { useReachfive } from '../../../contexts/reachfive';
16-
import { selectLogin } from '../authWidget.tsx';
17-
import { InitialScreen } from '../../../../constants.ts';
18-
import passwordField from '../../../components/form/fields/passwordField.tsx';
19-
import simplePasswordField from '../../../components/form/fields/simplePasswordField';
20-
import { DefaultButton } from '../../../components/form/buttonComponent.tsx';
21-
import { Validator } from '../../../core/validation.ts';
22-
import { useConfig } from '../../../contexts/config.tsx';
29+
import { useReachfive } from '../../../contexts/reachfive'
30+
import { useRouting } from '../../../contexts/routing'
31+
import { Validator } from '../../../core/validation.ts'
32+
import { selectLogin } from '../authWidget.tsx'
2333

24-
import type { OnError, OnSuccess } from '../../../types';
34+
import type { OnError, OnSuccess } from '../../../types'
2535

2636
type EmailIdentifier = { email: string }
2737
type PhoneNumberIdentifier = { phoneNumber: string }
@@ -42,27 +52,33 @@ const ForgotPasswordEmailForm = createForm<ForgotPasswordEmailFormData>({
4252
}),
4353
]
4454
},
45-
submitLabel: 'forgotPassword.submitLabel'
46-
});
55+
submitLabel: 'forgotPassword.submitLabel',
56+
})
4757

48-
const ForgotPasswordPhoneNumberForm = createForm<ForgotPasswordPhoneNumberFormData, { phoneNumberOptions?: PhoneNumberOptions }>({
58+
const ForgotPasswordPhoneNumberForm = createForm<
59+
ForgotPasswordPhoneNumberFormData,
60+
{ phoneNumberOptions?: PhoneNumberOptions }
61+
>({
4962
prefix: 'r5-forgot-password-',
5063
fields({ config, phoneNumberOptions }) {
5164
return [
52-
phoneNumberField({
53-
key: 'phoneNumber',
54-
label: 'phoneNumber',
55-
required: true,
56-
withCountryCallingCode: false,
57-
...phoneNumberOptions,
58-
}, config)
65+
phoneNumberField(
66+
{
67+
key: 'phoneNumber',
68+
label: 'phoneNumber',
69+
required: true,
70+
withCountryCallingCode: false,
71+
...phoneNumberOptions,
72+
},
73+
config
74+
),
5975
]
6076
},
61-
submitLabel: 'forgotPassword.submitLabel.code'
62-
});
77+
submitLabel: 'forgotPassword.submitLabel.code',
78+
})
6379

6480
export type VerificationCodeFormData = {
65-
password: string,
81+
password: string
6682
passwordConfirmation: string
6783
verificationCode: string
6884
}
@@ -75,34 +91,44 @@ interface VerificationCodeFormProps {
7591
canShowPassword?: boolean
7692
}
7793

78-
const VerificationCodeForm = createForm<VerificationCodeFormData, VerificationCodeFormProps>({
94+
const VerificationCodeForm = createForm<
95+
VerificationCodeFormData,
96+
VerificationCodeFormProps
97+
>({
7998
prefix: 'r5-verification-code-',
8099
fields({ canShowPassword = false, config }) {
81100
return [
82101
simpleField({
83102
key: 'verification_code',
84103
label: 'verificationCode',
85-
type: 'text'
104+
type: 'text',
86105
}),
87-
passwordField({
88-
label: 'newPassword',
89-
autoComplete: 'new-password',
90-
canShowPassword
91-
}, config),
106+
passwordField(
107+
{
108+
label: 'newPassword',
109+
autoComplete: 'new-password',
110+
canShowPassword,
111+
},
112+
config
113+
),
92114
simplePasswordField({
93115
key: 'password_confirmation',
94116
label: 'passwordConfirmation',
95117
autoComplete: 'new-password',
96-
validator: new Validator<string, FormContext<VerificationCodeFormData>>({
118+
validator: new Validator<
119+
string,
120+
FormContext<VerificationCodeFormData>
121+
>({
97122
rule: (value, ctx) => value === ctx.fields.password,
98-
hint: 'passwordMatch'
99-
})
100-
})
123+
hint: 'passwordMatch',
124+
}),
125+
}),
101126
]
102-
}
127+
},
103128
})
104129

105-
const skipError = (error: unknown) => isAppError(error) ? error.error === 'resource_not_found' : false;
130+
const skipError = (error: unknown) =>
131+
isAppError(error) ? error.error === 'resource_not_found' : false
106132

107133
export interface ForgotPasswordViewProps {
108134
/**
@@ -155,12 +181,12 @@ export interface ForgotPasswordViewProps {
155181
* The URL sent in the email to which the user is redirected.
156182
* This URL must be whitelisted in the `Allowed Callback URLs` field of your ReachFive client settings.
157183
*/
158-
redirectUrl?: string,
184+
redirectUrl?: string
159185
/**
160186
* Returned in the `redirectUrl` as a query parameter, this parameter is used to redirect users to a specific URL after a password reset.
161187
* Important: This parameter should only be used with Hosted Pages.
162188
*/
163-
returnToAfterPasswordReset?: string,
189+
returnToAfterPasswordReset?: string
164190
/**
165191
* Callback function called when the request has succeed.
166192
*/
@@ -193,13 +219,19 @@ export const ForgotPasswordView = ({
193219
const callback = useCallback(
194220
(data: ForgotPasswordEmailFormData) => {
195221
return ReCaptcha.handle(
196-
{...data, redirectUrl, returnToAfterPasswordReset},
222+
{ ...data, redirectUrl, returnToAfterPasswordReset },
197223
{ recaptcha_enabled, recaptcha_site_key },
198224
coreClient.requestPasswordReset,
199-
"forgot_password"
225+
'forgot_password'
200226
)
201227
},
202-
[coreClient, recaptcha_enabled, recaptcha_site_key, redirectUrl, returnToAfterPasswordReset]
228+
[
229+
coreClient,
230+
recaptcha_enabled,
231+
recaptcha_site_key,
232+
redirectUrl,
233+
returnToAfterPasswordReset,
234+
]
203235
)
204236

205237
useLayoutEffect(() => {
@@ -222,12 +254,20 @@ export const ForgotPasswordView = ({
222254
/>
223255
{allowPhoneNumberResetPassword && config.sms && (
224256
<Alternative>
225-
<DefaultButton onClick={() => goTo('forgot-password-phone-number')}>{i18n('forgotPassword.usePhoneNumberButton')}</DefaultButton>
257+
<DefaultButton
258+
onClick={() => goTo('forgot-password-phone-number')}
259+
>
260+
{i18n('forgotPassword.usePhoneNumberButton')}
261+
</DefaultButton>
226262
</Alternative>
227263
)}
228264
{allowLogin && (
229265
<Alternative>
230-
<Link target={selectLogin(initialScreen, allowWebAuthnLogin)}>{i18n('forgotPassword.backToLoginLink')}</Link>
266+
<Link
267+
target={selectLogin(initialScreen, allowWebAuthnLogin)}
268+
>
269+
{i18n('forgotPassword.backToLoginLink')}
270+
</Link>
231271
</Alternative>
232272
)}
233273
</div>
@@ -251,22 +291,27 @@ export const ForgotPasswordPhoneNumberView = ({
251291
const { goTo } = useRouting()
252292
const i18n = useI18n()
253293

254-
const [phoneNumber, setPhoneNumber] = useState<string>('')
255-
256294
const callback = useCallback(
257295
(data: ForgotPasswordPhoneNumberFormData) => {
258-
setPhoneNumber(data.phoneNumber)
259296
return ReCaptcha.handle(
260-
{...data, redirectUrl, returnToAfterPasswordReset},
297+
{ ...data, redirectUrl, returnToAfterPasswordReset },
261298
{ recaptcha_enabled, recaptcha_site_key },
262299
coreClient.requestPasswordReset,
263-
"forgot_password"
264-
)
300+
'forgot_password'
301+
).then(() => data)
265302
},
266-
[coreClient, recaptcha_enabled, recaptcha_site_key, redirectUrl, returnToAfterPasswordReset]
303+
[
304+
coreClient,
305+
recaptcha_enabled,
306+
recaptcha_site_key,
307+
redirectUrl,
308+
returnToAfterPasswordReset,
309+
]
267310
)
268311

269-
const onSuccess = () => goTo<PhoneNumberIdentifier>('forgot-password-code', { phoneNumber })
312+
const onSuccess = ({ phoneNumber }: PhoneNumberIdentifier) => {
313+
goTo<PhoneNumberIdentifier>('forgot-password-code', { phoneNumber })
314+
}
270315

271316
useLayoutEffect(() => {
272317
importGoogleRecaptchaScript(recaptcha_site_key)
@@ -285,11 +330,17 @@ export const ForgotPasswordPhoneNumberView = ({
285330
phoneNumberOptions={phoneNumberOptions}
286331
/>
287332
<Alternative>
288-
<DefaultButton onClick={() => goTo('forgot-password')}>{i18n('forgotPassword.useEmailButton')}</DefaultButton>
333+
<DefaultButton onClick={() => goTo('forgot-password')}>
334+
{i18n('forgotPassword.useEmailButton')}
335+
</DefaultButton>
289336
</Alternative>
290337
{allowLogin && (
291338
<Alternative>
292-
<Link target={selectLogin(initialScreen, allowWebAuthnLogin)}>{i18n('forgotPassword.backToLoginLink')}</Link>
339+
<Link
340+
target={selectLogin(initialScreen, allowWebAuthnLogin)}
341+
>
342+
{i18n('forgotPassword.backToLoginLink')}
343+
</Link>
293344
</Alternative>
294345
)}
295346
</div>
@@ -306,13 +357,14 @@ export const ForgotPasswordCodeView = ({
306357
onSuccess = (() => {}) as OnSuccess,
307358
}: ForgotPasswordViewProps) => {
308359
const coreClient = useReachfive()
309-
const { goTo, params } = useRouting()
310360
const i18n = useI18n()
361+
const { goTo, params } = useRouting()
362+
const { phoneNumber } = params as PhoneNumberIdentifier
311363

312364
const callback = useCallback(
313365
({ passwordConfirmation: _, ...data }: VerificationCodeFormData) => {
314366
return coreClient.updatePassword({
315-
...(params as PhoneNumberIdentifier),
367+
phoneNumber,
316368
...data,
317369
})
318370
},
@@ -335,7 +387,11 @@ export const ForgotPasswordCodeView = ({
335387
/>
336388
{allowLogin && (
337389
<Alternative>
338-
<Link target={selectLogin(initialScreen, allowWebAuthnLogin)}>{i18n('back')}</Link>
390+
<Link
391+
target={selectLogin(initialScreen, allowWebAuthnLogin)}
392+
>
393+
{i18n('back')}
394+
</Link>
339395
</Alternative>
340396
)}
341397
</div>
@@ -345,7 +401,7 @@ export const ForgotPasswordCodeView = ({
345401
export const ForgotPasswordSuccessView = ({
346402
allowLogin = true,
347403
initialScreen,
348-
allowWebAuthnLogin = false
404+
allowWebAuthnLogin = false,
349405
}: ForgotPasswordViewProps) => {
350406
const i18n = useI18n()
351407
return (
@@ -354,7 +410,11 @@ export const ForgotPasswordSuccessView = ({
354410
<Info>{i18n('forgotPassword.successMessage')}</Info>
355411
{allowLogin && (
356412
<Alternative>
357-
<Link target={selectLogin(initialScreen, allowWebAuthnLogin)}>{i18n('back')}</Link>
413+
<Link
414+
target={selectLogin(initialScreen, allowWebAuthnLogin)}
415+
>
416+
{i18n('back')}
417+
</Link>
358418
</Alternative>
359419
)}
360420
</div>

0 commit comments

Comments
 (0)