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_user_name(self): print('----Change User Name----') print('To go back enter "/back"\n') print(f'Current User Name: {self.user_name}\n') new_user_name = input('Enter new user name: ') if new_user_name == '/back': self.show_dashboard() while not is_valid_user_name(new_user_name): new_user_name = input('Enter new user name: ') password = input('Enter password to confirm change: ') while password != self.password: print('\nWrong password!\n') password = input('Enter password to confirm change: ') self.user_name = new_user_name db.update_admin_user_name(self) print('\nUser Name changed.') Console.clear_screen(3) self.show_dashboard()