-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
31 lines (24 loc) · 855 Bytes
/
example.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
from user_account_system import UserAccountSystem
# Create an instance of the UserAccountSystem class and connect to the database
uas = UserAccountSystem('user_database.db')
# Register a new user
uas.register_user('john_doe', 'password123')
# Authenticate a user
if uas.authenticate_user('john_doe', 'password123'):
print('Authentication successful')
else:
print('Authentication failed')
# Change a user's password
uas.change_password('john_doe', 'new_password')
# List all users in the system
users = uas.list_users()
print('List of users:')
for user in users:
print(user[0])
# Delete a user from the system
uas.delete_user('john_doe')
# Register a new user with an existing username (should return False)
if uas.register_user('john_doe', 'password123'):
print('Registration successful')
else:
print('Registration failed')