amplify-ui icon indicating copy to clipboard operation
amplify-ui copied to clipboard

FR (Authenticator): Override function support for ChangePassword

Open irothenbaum opened this issue 2 years ago • 2 comments

On which framework/platform would you like to see this feature implemented?

Vue

Which UI component is this feature-request for?

Authenticator

Please describe your feature-request in detail.

Currently, the Authenticator component supports override functions for the following actions:[1]

  1. Auth.signUp | handleSignUp
  2. Auth.signIn | handleSignIn
  3. Auth.confirmSignIn | handleConfirmSignIn
  4. Auth.confirmSignUp | handleConfirmSignUp
  5. Auth.forgotPassword | handleForgotPassword
  6. Auth.forgotPasswordSubmit | handleForgotPasswordSubmit

However, it is missing support for other auth events such as changePassword. In our specific case, this has made it challenging to streamline the login experience between a returning user (no change password requirement) and a brand new user logging in for the first time (one who must first statisfy the NEW_PASSWORD_REQUIRED challenge). I believe being able to simply receive the ChangePassword auth event in the same way we can receive the SignIn auth event would allow us to centralize the app entry logic universally.

1: Authenticator customization docs

Please describe a solution you'd like.

No specific implementation preferences; just want to be able to override the changePassword event with the Authenticator component.

(Not sure if duplicate of issue 3418, please close if so)

We love contributors! Is this something you'd be interested in working on?

  • [X] 👋 I may be able to implement this feature request.
  • [ ] ⚠️ This feature might incur a breaking change.

irothenbaum avatar Mar 09 '23 14:03 irothenbaum

Hi @irothenbaum! I think you mean forceNewPassword (which happens after sign in and Cognito gives NEW_PASSWORD_REQUIRED to force change password).

I could confirm that API is not overridable:

https://github.com/aws-amplify/amplify-ui/blob/8fe1c7ef80690ac2b415edff3796ceaaf8cfe427/packages/ui/src/machines/authenticator/actors/signIn.ts#L600-L604

we'll keep you updated on this feature request, thanks!

wlee221 avatar Mar 09 '23 19:03 wlee221

This would be really helpful. Currently I'm hacking away at a solution by using the Hub.listen which isn't great...

Dazaer avatar May 18 '23 14:05 Dazaer