def add_user(self): print("----Add User----\n") users = [] add_more = True while add_more: user_first_name = input("Enter First Name: ") while not is_valid_name(user_first_name): user_first_name = input("Enter First Name: ") user_first_name = format_name(user_first_name) user_last_name = format_name(input("Enter Last Name: ")) while not is_valid_name(user_last_name): user_last_name = input("Enter Last Name: ") user_last_name = format_name(user_last_name) user_email = input("Enter Email: ") while not is_valid_email(user_email): user_email = input("Enter Email: ") user_user_name = input("Enter User Name: ") while not is_valid_user_name(user_user_name): user_user_name = input("Enter User Name: ") user_password = input("Enter Password: "******"Enter Password: "******"Confirm Password: "******"Enter Password: "******"Enter Password: "******"Confirm Password: "******"%d-%m-%Y") new_user = User(user_first_name, user_last_name, user_user_name, user_email, user_password, date_added) users.append(new_user) response = input("\nAdd another user (Y/N): ").lower() if response == 'n': add_more = False db.insert_multiple_user(users) if len(users) > 1: print('Users have been added.\n') else: print('User has been added.\n') Console.clear_screen(2) show_admin_menu(self)
def register_user(): print("----Rick Inc Registration Form----\n") user_first_name = input("Enter First Name: ") while not is_valid_name(user_first_name): user_first_name = input("Enter First Name: ") user_first_name = format_name(user_first_name) user_last_name = format_name(input("Enter Last Name: ")) while not is_valid_name(user_last_name): user_last_name = input("Enter Last Name: ") user_last_name = format_name(user_last_name) user_email = input("Enter Email: ") while not is_valid_email(user_email): user_email = input("Enter Email: ") user_user_name = input("Enter User Name: ") while not is_valid_user_name(user_user_name): user_user_name = input("Enter User Name: ") user_password = input("Enter Password: "******"Enter Password: "******"Confirm Password: "******"Enter Password: "******"Enter Password: "******"Confirm Password: "******"%d-%m-%Y") new_user = User(user_first_name, user_last_name, user_user_name, user_email, user_password, date_added) db.insert_user(new_user) print("Thank you for registering with us!") print("Redirecting to login page...") sleep(3) Console.clear_screen(3) login_user()
def change_email(self): print('----Change Email----') print('To go back enter "/back"\n') print(f'Current Email: {self.email}\n') new_email = input('Enter new email address: ') if new_email == '/back': Console.clear_screen(1) self.show_dashboard() while not is_valid_email(new_email): new_email = input('Enter new email address: ') password = input('Enter password to confirm change: ') while password != self.password: password = input('Enter password to confirm change: ') self.email = new_email db.update_user_email(self) print('\nEmail changed.') Console.clear_screen(3) self.show_dashboard()