From 988a315d3f8d3110e4575d83c513c0dd0567b114 Mon Sep 17 00:00:00 2001 From: alexaorrico Date: Sat, 23 Dec 2017 03:52:29 +0000 Subject: [PATCH] fix encoding of password and remove double hashing --- models/user.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/models/user.py b/models/user.py index c6d63ce..faa2430 100755 --- a/models/user.py +++ b/models/user.py @@ -1,6 +1,5 @@ #!/usr/bin/python3 """ holds class User""" -from base64 import b64encode import hashlib import models from models.base_model import BaseModel, Base @@ -36,9 +35,6 @@ class User(BaseModel, Base): def __init__(self, *args, **kwargs): """initializes user""" - if 'password' in kwargs: - pwd = hashlib.md5(b64encode(kwargs['password'].encode('ascii'))) - kwargs['password'] = pwd.hexdigest() super().__init__(*args, **kwargs) @property @@ -48,5 +44,4 @@ def password(self): @password.setter def password(self, pwd): """hashing password values""" - self._password = hashlib.md5(b64encode(pwd - .encode('ascii'))).hexdigest() + self._password = hashlib.md5(pwd.encode()).hexdigest()