Skip to content

Add services override for forcing new password #6604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/seven-flies-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@aws-amplify/ui': minor
---

Added services.handleForceChangePassword hook
3 changes: 1 addition & 2 deletions packages/ui/src/machines/authenticator/actors/signIn.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { createMachine, sendUpdate } from 'xstate';
import type { ConfirmSignInInput } from 'aws-amplify/auth';
import {
confirmSignIn,
fetchUserAttributes,
resetPassword,
signInWithRedirect,
Expand Down Expand Up @@ -345,7 +344,7 @@ export function signInActor({ services }: SignInMachineOptions) {
options: { userAttributes },
};

return confirmSignIn(input);
return services.handleForceChangePassword(input);
},
signInWithRedirect(_, { data }) {
return signInWithRedirect(data);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export const defaultServices = {
handleForgotPasswordSubmit: confirmResetPassword,
handleForgotPassword: resetPassword,
handleResendSignUpCode: resendSignUpCode,
handleForceChangePassword: confirmSignIn,

// Validation hooks for overriding
async validateCustomSignUp(
Expand Down