def submit_register_form(ui): global manager_add_user name_in = ui.name.toPlainText() email_in = ui.email.toPlainText() phone_in = ui.phone.toPlainText() passwd_in = ui.passwd.toPlainText() role_in = ui.selected_role.currentText() register.register_user(name_in, email_in, phone_in, passwd_in, role_in) if manager_add_user is True: manager.approve(email_in) sql = "SELECT email,phone,username FROM Registrations" cursor.execute(sql) pending_list = cursor.fetchall() ui.tableWidget.clear() manager.fill_table(ui, pending_list) ui.PageStack.setCurrentIndex(2) manager_add_user = False else: ui.PageStack.setCurrentIndex(0)
def welcome(selection): print( "\nWelcome to the JunkFood Delivery!\n1. Login\n2. Register\n3. Menu\n0. Exit" ) selection = 0 try: selection = input() selection = int(selection) except ValueError: print("Please enter the number in the list") if selection == 1: login.login_page(username="", password="") if selection == 2: register.register_user(user="", password="") if selection == 3: menu.Menu() if selection == 0: print("ByeBye!") quit() return selection
print(Fore.BLUE + "your account is created.you can sign in.") print(Fore.GREEN + dash) break elif check == 0: print(Fore.RED + "user name exists") print(Fore.GREEN + dash) continue else: print(Fore.RED + "your code is wrong!") print(Fore.GREEN + dash) elif choice_2 == "2": while True: user_name, password = register.enter_user() check = register.check_user(user_name, 'user.csv') if check == 1 or check == None: register.register_user(user_name, password, "user.csv") log.info_logger.info(f"user with user_name : {user_name} registers.") print(Fore.BLUE + "your account is created.you can sign in. ") print(Fore.GREEN + dash) break elif check == 0: print(Fore.RED + "user name exists.") print(Fore.GREEN + dash) continue elif choice == "3": break else: print("Your choice is wrong!") continue
def test_role2(self): self.assertFalse(r.register_user('*****@*****.**', 'KhayyamPassword', 'KhayyamPassword', 'Roman', 'Jackson', 'Plumber'), 'FR001F - role is invalid')
def test_role1(self): self.assertTrue(r.register_user('*****@*****.**', 'KhayyamPassword', 'KhayyamPassword', 'Roman', 'Jackson', 'Doctor'), 'FR001F - role is valid')
def test_email2(self): self.assertFalse(r.register_user('taavi@taltech@ee', 'KhayyamPassword', 'KhayyamPassword', 'Roman', 'Jackson', 'Doctor'), 'FR001E - email is invalid')
def test_password6(self): self.assertFalse(r.register_user('*****@*****.**', 'KhayyamPassword', 'Khayyam', 'Roman', 'Jackson', 'Doctor'), 'FR001D - Passwords do not match')
def test_password4(self): self.assertFalse(r.register_user('*****@*****.**', '1234', '1234', 'Khayyam', 'Jackson', 'Doctor'), 'FR001C - Password too short')
def test_password3(self): self.assertFalse(r.register_user('*****@*****.**', 'Jackson', 'Jackson', 'Roman', 'Jackson', 'Doctor'), 'FR001B - Password is lastname')
def test_password2(self): self.assertFalse(r.register_user('*****@*****.**', 'Khayyam', 'Khayyam', 'Khayyam', 'Jackson', 'Doctor'), 'FR001B - Password is firstname')
def test_lastname2(self): self.assertFalse(r.register_user('*****@*****.**', 'KhayyamPassword', 'KhayyamPassword', 'Roman', '', 'Doctor'), 'FR001A - lastname is empty')
def chat(): header = request.headers.get('Authorization') #header =request.headers['Authorization'] msg_received = flask.request.get_json() msg_subject = msg_received["subject"] #ACCOUNT CREATION AND LOGIN if msg_subject == "login": return me.getInfo(msg_received) elif msg_subject == "forgetPass": return forgot_pass.forgot_password(msg_received) elif msg_subject == "forgetPass_code": return forgot_pass.verify_pass_code(msg_received) elif msg_subject == "register": return register.register_user(msg_received) elif msg_subject == "resendVerification": return resend_verification.resendVerification(msg_received) elif msg_subject == "verifyUser": return verify_user.verify_user(msg_received) #ACCOUNT UPDATING elif msg_subject == "check_userName": return checkUserName.check_userName(msg_received) elif msg_subject == "check_email": return checkEmail.check_email(msg_received) elif msg_subject == "check_phoneNo": return checkPhoneNo.check_phoneNo(msg_received) elif msg_subject == "editMail": return editMail.editMail(msg_received) elif msg_subject == "editProfile": return edit_profile.edit_profile(msg_received, header) elif msg_subject == "changeMail": return change_email.update_email(msg_received, header) elif msg_subject == "verifyEmail": return verify_email.verify_email(msg_received, header) elif msg_subject == "changePass": return change_password.update_password(msg_received, header) elif msg_subject == "checkPass": return isPasswordCorrect.update_password(msg_received, header) elif msg_subject == "changePhoneNo": return change_phoneNo.update_phoneNo(msg_received, header) elif msg_subject == "changeUserName": return change_userName.update_userName(msg_received, header) elif msg_subject == "getData": return persistance.persist(header) #AWS IMAGE WORKS elif msg_subject == "uploadProfilePhoto": return upload_image.profile_photo(msg_received, header) elif msg_subject == "uploadCoverPhoto": return upload_image.cover_photo(msg_received, header) elif msg_subject == "postImage": return upload_image.post_image(msg_received, header) #MONGO WORK elif msg_subject == "normal_post": return create_doc.wall_post(msg_received, header) elif msg_subject == "mega_post": return create_doc.add_post(msg_received, header) elif msg_subject == "fetch_all": return fetchAllPost.fetchAll(header) elif msg_subject == "likePost": return likes.likePost(msg_received, header) elif msg_subject == "dislikePost": return likes.dislikePost(msg_received, header) elif msg_subject == "deletePost": return delete_post.deletePost(msg_received, header) elif msg_subject == "editPost": return edit_post.editPost(msg_received, header) else: return json.dumps({'Error': 'format not acceptable'}) #"Invalid request."
) print("Press 1 to register") print("Press 2 to Login") print("Press 3 to Compare cost") print("Press 4 to Pay") print("Press 5 to Recieve") print("Press 6 to Convert") print("Press 7 to Display rates") print("Press 8 for Help and FAQs") print("Press 9 to logout and exit") n = int(input()) print( "------------------------------------------------------------------" ) if n == 1: #registration of new user reg.register_user() elif n == 2: #login for user if login_status: #checks whether another or same user is already logged in print("User already logged in") else: login_status = lg.login() elif n == 3: #for comparing costs if login_status: #works only if user is logged in cc.compare() else: print("Please login") elif n == 4: #pay if not login_status: #works only if user is logged in print("Please login") elif pp.pay(): print("Payment successfull")