refactor(auth): Move check for verificated mail address to user class
This commit is contained in:
parent
b398d48533
commit
127a10f3d9
6 changed files with 21 additions and 24 deletions
|
|
@ -27,7 +27,7 @@ def authenticate(username, password):
|
|||
except (User.DoesNotExist, binascii.Error):
|
||||
raise exceptions.AuthenticationFailed("Wrong username or password.")
|
||||
|
||||
if common_authentication.should_verify_email(user):
|
||||
if user.should_verify_email():
|
||||
raise exceptions.AuthenticationFailed("You need to verify your e-mail address.")
|
||||
|
||||
return (user, None)
|
||||
|
|
@ -46,7 +46,7 @@ def authenticate_salt(username, salt, token):
|
|||
if expected != token:
|
||||
raise exceptions.AuthenticationFailed("Wrong username or password.")
|
||||
|
||||
if common_authentication.should_verify_email(user):
|
||||
if user.should_verify_email():
|
||||
raise exceptions.AuthenticationFailed("You need to verify your e-mail address.")
|
||||
|
||||
return (user, None)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue