Exemplo n.º 1
0
 def add_user(cls, username, password):
     for userid in cls.user_dict:
         if cls.user_dict[userid]['username'] == username:
             return "User already exists"
     hashed_pass = PasswordManager.hash(password)
     id = str(len(cls.user_dict) + 1)
     cls.user_dict[id] = User(id, username, hashed_pass)
     return None
Exemplo n.º 2
0
 def modify_user(cls, username, password):
     for userid in cls.user_dict:
         if cls.user_dict[userid]['username'] == username:
             hashed_pass = PasswordManager.hash(password)
             cls.user_dict[id].set_password(hashed_pass)
Exemplo n.º 3
0
 def set_password(self, password):
     self._password = PasswordManager.hash(password)
Exemplo n.º 4
0
 def authenticate(self, password):
     if self._password == PasswordManager.hash(password):
         self._authenticated = True
     return self._authenticated