Can the email alias be referenced as a template variable in the resendConfirmationCode and forgotPassword email templates?

0

Is there a way to reference the email alias in the the email template for reset password? I am using email as an alias and generating the cognito username (guid). But when the reset password email goes out I would like it to reference the email address rather than the generated username.

To illustrate, this is how the email is generated currently as it references {username}. Your username is aVwe3uyXcc9WbmkKTbNq4i and your temporary password is 1ZVKi@ZL.

I'd like to reference the email alias. Is that variable available to the email template?

I am passing email as the "Username" parameter to both resendConfirmationCode and forgotPassword methods and in both cases the {username} parameter in the template is replaced with the guid username rather than the email alias.

demandé il y a un an213 vues
1 réponse
0

Can you use the Custom Message Lambda for CustomMessage_ForgotPassword case and do a look up in the event.request.userAttributes for the appropriate value you need to craft your own message.

reference: https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html

AWS
répondu il y a un an
  • Thanks Jeff. One problem I got was that if I don't have usernameParameter in my template then the CustomMessage_ForgotPassword trigger is ignored. I suppose I could hide that variable in the html but that doesn't work for anything other than HTML.

  • I just confirmed that if I hide the usernameParameter in a hidden span tag in the custom message then the custom message is sent successfully (vs the default userpool message)

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions