{"action":"opened","issue":{"url":"https://api.github.com/repos/Tivix/django-rest-auth/issues/342","repository_url":"https://api.github.com/repos/Tivix/django-rest-auth","labels_url":"https://api.github.com/repos/Tivix/django-rest-auth/issues/342/labels{/name}","comments_url":"https://api.github.com/repos/Tivix/django-rest-auth/issues/342/comments","events_url":"https://api.github.com/repos/Tivix/django-rest-auth/issues/342/events","html_url":"https://github.com/Tivix/django-rest-auth/issues/342","id":238944014,"number":342,"title":"500 when logging in after changing email when email verification is mandatory","user":{"login":"bufke","id":739307,"avatar_url":"https://avatars2.githubusercontent.com/u/739307?v=3","gravatar_id":"","url":"https://api.github.com/users/bufke","html_url":"https://github.com/bufke","followers_url":"https://api.github.com/users/bufke/followers","following_url":"https://api.github.com/users/bufke/following{/other_user}","gists_url":"https://api.github.com/users/bufke/gists{/gist_id}","starred_url":"https://api.github.com/users/bufke/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bufke/subscriptions","organizations_url":"https://api.github.com/users/bufke/orgs","repos_url":"https://api.github.com/users/bufke/repos","events_url":"https://api.github.com/users/bufke/events{/privacy}","received_events_url":"https://api.github.com/users/bufke/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-06-27T18:38:51Z","updated_at":"2017-06-27T18:38:51Z","closed_at":null,"body":"See https://github.com/Tivix/django-rest-auth/blob/master/rest_auth/serializers.py#L105\r\n\r\nIf using django rest auth with a django based (server side) interface and the django-allauth authentication class it's possible to get in a situation where the user changes their email, authenticates via the api, and gets a 500 error allauth.account.models.DoesNotExist.\r\n\r\nThis is because changing the user's email (assuming default User model) does not change or add a row to the emailaddress_set. There are situations where we might want users to verify their sign up email, but allow them to change the email without validating it.\r\n\r\nI would propose one of the following solutions:\r\n\r\n`email_address = user.emailaddress_set.filter(user=user, verified=True).exists()` this would allow users to sign in with an invalidated changed email - matching django allauth default behavior. The user would still need at least one verified email.\r\n\r\nOr \r\n\r\ncatching the DoesNotExist exception and raising a ValidationError(_('E-mail is not verified.')).\r\n\r\nFor now it's possible to just extend the LoginSerializer and modify the validate method."}}
{"actor":{"display_login":"bufke"}}