mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-07-22 05:29:46 +03:00
Resend confirmation email
When trying to login using an unverified email address, resend confirmation email.
This commit is contained in:
parent
e4c04528a2
commit
8de37ca465
|
@ -104,6 +104,9 @@ class LoginSerializer(serializers.Serializer):
|
|||
if app_settings.EMAIL_VERIFICATION == app_settings.EmailVerificationMethod.MANDATORY:
|
||||
email_address = user.emailaddress_set.get(email=user.email)
|
||||
if not email_address.verified:
|
||||
email_address.send_confirmation(
|
||||
request=self.context.get('request')
|
||||
)
|
||||
raise serializers.ValidationError(_('E-mail is not verified.'))
|
||||
|
||||
attrs['user'] = user
|
||||
|
|
|
@ -482,6 +482,7 @@ class APIBasicTests(TestsMixin, TestCase):
|
|||
data={"key": email_confirmation.key},
|
||||
status_code=status.HTTP_200_OK
|
||||
)
|
||||
self.assertEqual(len(mail.outbox), mail_count + 1)
|
||||
|
||||
# try to login again
|
||||
self._login()
|
||||
|
|
Loading…
Reference in New Issue
Block a user