Cadasta / cadasta-platform

[DEPRECATED] Main repository of the Cadasta platform. Technology to help communities document their land rights around the world.
https://demo.cadasta.org
GNU Affero General Public License v3.0
53 stars 81 forks source link

Subsequent activation emails not sent for inactive user accounts #1370

Closed amplifi closed 7 years ago

amplifi commented 7 years ago

Steps to reproduce the error

Register an account but do not click the link in the activation email. Allow the account to be marked inactive after waiting period, then try logging in with the account again.

Actual behavior

The error message as above states that an activation email has been sent. Activation email doesn't get re-sent.

Expected behavior

Activation message should be re-sent to the email address registered to the user account to allow the user to activate.

valaparthvi commented 7 years ago

Hey @amplifi, I have tried this one before on my local environment, and I think it does resend an activation email. But still I'll try to reproduce this error, and I would like to solve this one if no one is working. Thanks.

valaparthvi commented 7 years ago

Hey @amplifi, so I tried reproducing the error on my local environment. 1) I did vagrant ssh 2) Created new user account named "student". 3) logged out and logged back in 4) It showed Account Inactive page, but no confirmation mail is sent. screenshot from 2017-04-03 00-37-26

5) I did ctrl+c and ended that session. 6) I ran vagrant ssh and started a new session. 7) logged in that user account. 8) It showed Account Inactive page, and sent a confirmation mail. screenshot from 2017-04-03 00-37-50

So there is some bug, I'll update this asap.

pyaf commented 7 years ago

@valaparthvi @amplifi I have found that send_email_confirmation method has a COOLDOWN_PERIOD set as 3 minutes. According to allauth:

E-mail verification mails are sent:
a) Explicitly: when a user signs up
b) Implicitly: when a user attempts to log in using an unverified
e-mail while EMAIL_VERIFICATION is mandatory.
Especially in case of b), we want to limit the number of mails
sent (consider a user retrying a few times), which is why there is
a cooldown period before sending a new mail.

Check here So, if you try logging in after 3 minutes, a new confirmation mail is sent. :)

amplifi commented 7 years ago

This isn't a case of the expected 3-minute delay. I have four inactive user accounts across staging and demo that have not received activation emails after log in attempts on Thursday last week. Our SMTP service also shows no activation emails triggered for these accounts. I'll be investigating further.

valaparthvi commented 7 years ago

okay @amplifi

amplifi commented 7 years ago

Can't replicate on current staging env; will re-open if issue occurs again.

dpalomino commented 7 years ago

Thanks @amplifi. I think this is still happening in demo, I tried with my "dpalomino" disabled account in demo and the mail was not sent.

oliverroick commented 7 years ago

@dpalomino Was your account manually deactivated or as a result of not verifying your email.

In the former case, it is expected behavior that no verification email is sent. Accounts are usually deactivated for a reason. For example, when the account has been used inappropriately You shouldn't able to re-activate the account just by receiving an email and clicking on the link.

amplifi commented 7 years ago

@dpalomino @oliverroick According to the db, the dpalomino account in demo is both deactivated and already email verified. Confirmed: a verification email should not be expected behavior. Let's re-open if there are issues with expected behavior in the future.