Skip to content

Commit 00d2adc

Browse files
authored
Merge pull request #18353 from mozilla/FXA-11073
fix(settings) - Navigate to settings in a password-reset/sync flow
2 parents d75b13d + b8dc392 commit 00d2adc

1 file changed

Lines changed: 27 additions & 3 deletions

File tree

  • packages/fxa-settings/src/pages/ResetPassword/ResetPasswordWithRecoveryKeyVerified

packages/fxa-settings/src/pages/ResetPassword/ResetPasswordWithRecoveryKeyVerified/container.tsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ import {
1212
Integration,
1313
isOAuthIntegration,
1414
useAccount,
15+
useAlertBar,
1516
useAuthClient,
17+
useFtlMsgResolver,
1618
useSensitiveDataClient,
1719
} from '../../../models';
1820
import {
@@ -29,6 +31,8 @@ const ResetPasswordWithRecoveryKeyVerifiedContainer = ({
2931
}: ResetPasswordWithRecoveryKeyVerifiedProps & RouteComponentProps) => {
3032
const [showHint, setShowHint] = useState(false);
3133

34+
const alertBar = useAlertBar();
35+
const ftlMsgResolver = useFtlMsgResolver();
3236
const navigateWithQuery = useNavigateWithQuery();
3337
const sensitiveDataClient = useSensitiveDataClient();
3438

@@ -59,10 +63,30 @@ const ResetPasswordWithRecoveryKeyVerifiedContainer = ({
5963
if (!recoveryKey) {
6064
// If we get here, that means a password reset was completed (with a verified account).
6165
// Along the way, we have lost a copy of the recovery key in memory if the page was unloaded.
62-
// This is fine - we navigate to the confirmed page and carry on.
63-
navigateWithQuery('/reset_password_verified', { replace: true });
66+
// This is fine - we navigate to the confirmed or settings page and carry on.
67+
const navigationPath = integration.isSync()
68+
? '/settings'
69+
: '/reset_password_verified';
70+
navigateWithQuery(navigationPath, { replace: true });
71+
72+
// For web integration and sync navigate to settings
73+
// Sync users will see an account recovery key promotion banner in settings
74+
// if they don't have one configured
75+
alertBar.success(
76+
ftlMsgResolver.getMsg(
77+
'reset-password-complete-header',
78+
'Your password has been reset'
79+
)
80+
);
6481
}
65-
}, [recoveryKey, email, navigateWithQuery]);
82+
}, [
83+
recoveryKey,
84+
email,
85+
navigateWithQuery,
86+
integration,
87+
alertBar,
88+
ftlMsgResolver,
89+
]);
6690

6791
if (!recoveryKey || !email) {
6892
return <></>;

0 commit comments

Comments
 (0)