Skip to content
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

Resending user signup confirmation email #50

Open
amankejriwal opened this issue Apr 8, 2021 · 6 comments
Open

Resending user signup confirmation email #50

amankejriwal opened this issue Apr 8, 2021 · 6 comments

Comments

@amankejriwal
Copy link

Is there a way to send the confirmation email that a new user receives upon signup?

@brleinad
Copy link

I think that's what send_verification is for.
@amankejriwal did you try that already?

@circulon
Copy link

circulon commented Jan 12, 2022

I think that's what send_verification is for. @amankejriwal did you try that already?

send_verification requires an active access token which is obviously not available if the user has not yet
a. confirmed their registration
b. logged in to get the access token

The client method "resend_confirmation_code" achieves what the OP was asking.
I've literally just had this as a requirement (ie my confirm code expired) and resend_confirmation_code
is missing ;(

Will look into adding this shortly

@circulon
Copy link

@amankejriwal
A bit late I know but I have addressed this issue in #99

@nk9
Copy link

nk9 commented Feb 25, 2022

Thanks for adding that method. It's important to note, however that admins who have created a user with admin_create_user cannot use resend_confirmiation_code. If you want the welcome email to be re-sent and you're OK with re-setting the user's password, then do this instead:

u = Cognito('your-user-pool-id', 'your-client-id')

user = u.admin_create_user(
    user_email_address,
    temporary_password='NewPassword^56',
    additional_kwargs={`'MessageAction': 'RESEND'},
)

Source: StackOverflow

@circulon
Copy link

Thanks for the info @nk9
This caveat should probably go into the docs
I will try and find a spot for this when I have time as I use both self register and admin create user methods in my project.

Cheers for the FYI

@nk9
Copy link

nk9 commented Mar 2, 2022

I've discovered another fun caveat. The "RESEND" trick above only works if the user's status is FORCE_CHANGE_PASSWORD. Sort of makes sense, I guess. If the user has successfully signed in (state of CONFIRMED), then you have to use admin_reset_password(), which will send an email with the verification code, and force a password reset on next sign in (user Enabled, status RESET_REQUIRED). This means the user has to have their old password available. The user will receive an email, but it will be as if they've clicked "Forgot my password" in the UI. So it won't exactly meet OP's request of getting the original email re-sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants