-
Notifications
You must be signed in to change notification settings - Fork 0
/
user.py
38 lines (32 loc) · 981 Bytes
/
user.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import credentials
class User:
"""
Class that generates new instances of account users
"""
users_list = []
def __init__(self, username, password):
self.username = username
self.password = password
self.credential=credentials.Credentials()
@classmethod
def add_new_user(cls, new_user):
"""This adds a new user to the users list."""
cls.users_list.append(new_user)
@classmethod
def check_login(cls, login_name, login_password):
"""This method checks whether the user login details exist in the users_list"""
for user in cls.users_list:
if user.username==login_name:
if user.password==login_password:
return True
return False
@classmethod
def return_user(cls, username, password):
"""
Method to check show the user upon successful login
"""
for user in cls.users_list:
if user.username==username:
if user.password==password:
return user
return False