lingthio / Flask-User

Customizable User Authorization & User Management: Register, Confirm, Login, Change username/password, Forgot password and more.
http://flask-user.readthedocs.io/
MIT License
1.06k stars 292 forks source link

Superfluous e-mail verification request after accepted invitation #182

Closed matthijskooijman closed 7 years ago

matthijskooijman commented 7 years ago

When an invitation is sent to an e-mail address, and in response an account is registered using that same e-mail address, this e-mail can already be considered confirmed. views.register() also contains logic for this:

    require_email_confirmation = True
    if user_invite:
        if user_invite.email == register_form.email.data:
            require_email_confirmation = False
            db_adapter.update_object(user, confirmed_at=datetime.utcnow())

Further on, require_email_confirmation is passed on to _USER_SEND_REGISTERED_EMAIL which adapts the flash message accordingly, but the e-mail sent out asks for confirmation regardless of the fact that this is no longer needed.

I tested this using 0.6.13, but I think the git master version (as linked above) still has this problem.

matthijskooijman commented 7 years ago

On closer inspection (and testing by someone with a HTML-capable mailclient), I discovered that this is only a problem in the text version, the HTML version has a check for it. e.g. compare:

matthijskooijman commented 7 years ago

Thanks!