-
Notifications
You must be signed in to change notification settings - Fork 0
/
userAccount20.py
67 lines (53 loc) · 1.88 KB
/
userAccount20.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
class UserAccount:
"""A class representing a user account with username and password."""
def __init__(self, username, password):
"""
Initialize a UserAccount object.
:param username: The username for the user account.
:type username: str
:param password: The password for the user account.
:type password: str
"""
self.username = username
self.password = password
def create_username(self, new_username):
"""
Change the username of the user account.
:param new_username: The new username to set.
:type new_username: str
"""
self.username = new_username
def create_password(self, new_password):
"""
Change the password of the user account.
:param new_password: The new password to set.
:type new_password: str
"""
self.password = new_password
def retrieve_login_details(self):
"""
Retrieve the login details of the user account.
:return: A dictionary containing the username and password.
:rtype: dict
"""
return {'username': self.username, 'password': self.password}
def change_username(self, new_username):
"""
Change the username of the user account.
:param new_username: The new username to set.
:type new_username: str
"""
self.username = new_username
def change_password(self, new_password):
"""
Change the password of the user account.
:param new_password: The new password to set.
:type new_password: str
"""
self.password = new_password
def delete_username(self):
"""Delete the username of the user account."""
self.username = None
def delete_password(self):
"""Delete the password of the user account."""
self.password = None