Skip to content

Commit

Permalink
fixed login method
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Feb 4, 2019
1 parent 16b30a9 commit e90e4dc
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions masonite/auth/Auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,6 @@ def login(self, name, password):
"""
auth_column = self.auth_model.__auth__

try:
password_column = self.auth_model.password if hasattr(self.auth_model, 'password') else self.auth_model.__password__
except AttributeError as e:
raise AttributeError('Your model does not have a password column or a designated __password__ attribute. Set the __password__ attribute to the name of your password column.') from e

try:
# Try to login multiple or statements if given an auth list
if isinstance(auth_column, list):
Expand All @@ -80,7 +75,7 @@ def login(self, name, password):
else:
model = self.auth_model.where(auth_column, name).first()

if model and bcrypt.checkpw(bytes(password, 'utf-8'), bytes(password_column, 'utf-8')):
if model and bcrypt.checkpw(bytes(password, 'utf-8'), bytes(model.password, 'utf-8')):
if not self._once:
remember_token = str(uuid.uuid4())
model.remember_token = remember_token
Expand Down

0 comments on commit e90e4dc

Please sign in to comment.