Tivix / django-rest-auth

This app makes it extremely easy to build Django powered SPA's (Single Page App) or Mobile apps exposing all registration and authentication related functionality as CBV's (Class Base View) and REST (JSON)
www.tivix.com
MIT License
2.41k stars 661 forks source link

Logging in with an unverified email does not resend the activation email #278

Open Vektrat opened 8 years ago

Vektrat commented 8 years ago

Hello,

I've been struggling with this for a while and I believe django-rest-auth is skipping some allauth code when logging in.

Users with mandatory email validation receive the email verification link when registering via rest-auth. However, the email is never resent in case they try again after a few days.

According to allauth, there is no way to force an email resend out of the box, however the email is sent automatically on a failed login due to an unverified email (with a little cooldown).

I've tried this with allauth and it works, but signing in with rest-auth does not send the email again.

jvgelder commented 6 years ago

I just bumped into the very same issue. The issue is that restauth does not trigger the allauth functionality that checks whether the user is verified or not. Allauth does this in https://github.com/pennersr/django-allauth/blob/519f1f2026691a98e76f5fc3d998d235e53cfe57/allauth/account/utils.py#L117 which then calls https://github.com/pennersr/django-allauth/blob/519f1f2026691a98e76f5fc3d998d235e53cfe57/allauth/account/utils.py#L283.

Maybe we can fix this by calling the perform_login function in the login view. For now we should at least make it clear in the docs this is not supported atm.

steverecio commented 5 years ago

Just ran into this issue. Has anyone opened a PR to call the allauth perform_login function instead of the django login function if allauth is installed? Seems like this could be done pretty easily here: https://github.com/Tivix/django-rest-auth/blob/master/rest_auth/views.py#L52

Alternatively, maybe we can add a new rest endpoint to resend the confirmation email. Here is the relevant allauth function: https://github.com/pennersr/django-allauth/blob/master/allauth/account/utils.py#L281

opeodedeyi commented 4 years ago

Just ran into this issue. Has anyone opened a PR to call the allauth perform_login function instead of the django login function if allauth is installed? Seems like this could be done pretty easily here: https://github.com/Tivix/django-rest-auth/blob/master/rest_auth/views.py#L52

Alternatively, maybe we can add a new rest endpoint to resend the confirmation email. Here is the relevant allauth function: https://github.com/pennersr/django-allauth/blob/master/allauth/account/utils.py#L281

Bro if possible, can you share how you solved this issue. Please, I have been stuck for a week

raunaqss commented 4 years ago

@opeodedeyi

Not necessary to call the perform_login function from allauth as rest_framework is already checking for the same in the Login serialiser if rest_auth.registration is in INSTALLED_APPS.

If you're not using rest_auth.registration (like me), then just remove the if statement and you're good.