Skip to content

Commit 0b19734

Browse files
committed
Now checking if the email is confirmed before we authenticate
1 parent ff0a4fe commit 0b19734

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

rest_framework_firebase/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
__title__ = 'djangorestframework-firebase-auth'
4-
__version__ = '0.1.1'
4+
__version__ = '0.1.2'
55
__author__ = 'Wesley Lima'
66
__license__ = 'MIT'
77
__copyright__ = 'Copyright 2018 Fan Retreat, Inc.'

rest_framework_firebase/authentication.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,10 @@ def authenticate_credentials(self, payload):
5353
if not uid:
5454
msg = _('Invalid payload.')
5555
raise exceptions.AuthenticationFailed(msg)
56-
5756
try:
57+
if 'email_verified' not in payload or ('email_verified' in payload and not payload['email_verified']):
58+
msg = _('User email not yet confirmed.')
59+
raise exceptions.AuthenticationFailed(msg)
5860
user = User.objects.get(**{uid_field: uid})
5961
except User.DoesNotExist:
6062
if not api_settings.FIREBASE_CREATE_NEW_USER:

0 commit comments

Comments
 (0)