def new_registration(name): # name = input("Enter the username:"******"your registration is in process") customer = RegistrationModule.Customer() customer.set_username(name) email_id = input("Enter the emailid:") if All_validations.validate_email(email_id): customer.set_emailid(email_id) else: register() mobile_number = input("Enter the mobile number:") if All_validations.validate_phone_number(mobile_number): customer.set_mobilenumber(mobile_number) else: register() # password = input("Enter the password:"******"Enter the password:"******"Confirm the password:"******"your password did not match the crieteria") else: print("your passwords did not match. please reenter them") # else: # register() question = input("Enter the secret question:") customer.set_question(question) answer = input("Enter your answer:") customer.set_answer(answer) cityname = input("Enter your city:") customer.set_city(cityname) area = input("Enter your area:") customer.set_area(area) state = input("Enter your state:") customer.set_state(state) ViewDB.insert_new_user(name, email_id, mobile_number, pass_word1, question, answer, cityname, area, state) print("Registration successfull") username1 = input("Enter the username:"******"Enter the password:") # if All_validations.validate_existing_password(name,pass_word1): if ViewDB.login(username1, password1): city = ViewDB.login(username1, password1).get_city() area = ViewDB.login(username1, password1).get_area() print(city) print(area) Restaurants.restaurants()
def relogin(): username1 = input("Enter the username:"******"Enter the password:") # if All_validations.validate_existing_password(name,pass_word1): if ViewDB.login(username1, password1): city = ViewDB.login(username1, password1).get_city() area = ViewDB.login(username1, password1).get_area() print(city) print(area) Restaurants.restaurants(city, area)
def validate_existing_password(username, password): try: print(ViewDB.existing_password(username, password)) print(ViewDB.existing_password(username, password)[0]) if password != ViewDB.existing_password(username, password)[0]: return True else: raise AlreadyExistingPasswordException() except AlreadyExistingPasswordException as e: print(e) return False
def validate_item_available(category_items, restaurant_name): # print("///////////////////validate_item_available////////////////////") # print("In function validate_item_available") # print("In validate function class /Validate_item_available") # print("len(category_items)") # print(len(category_items)) list_of_item_available = ViewDB.get_food_items_availability( category_items, restaurant_name) # print("list_of_item_available") # print(list_of_item_available) if (len(list_of_item_available) == 0): print("No Rows Returned for that selected items") return False else: #If different number of rows returned compared to input & then not valid availability if len(category_items) != len(list_of_item_available): return False elif 'NA' in list_of_item_available: #print("Raising Exception") raise Validate_item_available() #return False else: #print("All Available validate function class /Validate_item_available") return True
def validate_view_category(restaurant_type): list_of_restaurant_categories = ViewDB.get_restaurant_categories( restaurant_type) if (len(list_of_restaurant_categories) == 0): raise CustomException2.InvalidCategoryException() return list_of_restaurant_categories
def validate_view_category_items(category): list_of_restaurant_categories_items = ViewDB.get_categories_fooditems( category) if (len(list_of_restaurant_categories_items) == 0): raise CustomException2.InvalidCatItemsException return list_of_restaurant_categories_items
def correct_password(username): input2 = input("Enter the password:"******"Confirm password:"******"your password is reseted") return True else: print("Your password does not meet the requirements, please refill them") return False else: print("Please check the password and type again") return False else: register()
def validate_view_category_items(category, restaurant): list_of_restaurant_categories_items = ViewDB.get_categories_fooditems( restaurant, category) if (len(list_of_restaurant_categories_items) == 0): #return False raise InvalidCatItemsException return list_of_restaurant_categories_items
def check_username(name): list_of_usernames = ViewDB.validate_username(username) flag = False for names in list_of_usernames: if names[0] == name: flag = True return False if flag == False: return True
def validate_item_present(category_items, restaurant_name): list_of_restaurant_categories = ViewDB.get_selected_food_items_present( category_items, restaurant_name) if (len(list_of_restaurant_categories) == 0): #print("Raising Exception") raise Validate_item_present() return list_of_restaurant_categories
def validate_view_category(restaurant_type): # print("///////////////////validate_view_category////////////////////") # print("In validate function class /validate_view_category") # print("In validate function class /validate_view_category") list_of_restaurant_categories = ViewDB.get_restaurant_categories( restaurant_type) if (len(list_of_restaurant_categories) == 0): #print("Raising Exception") raise InvalidCategoryException() return list_of_restaurant_categories
def validate_item_present(category_items): # print("///////////////////validate_item_present////////////////////") # print("In function validate_item_present") # print("In validate function class /validate_item_present") list_of_restaurant_categories = ViewDB.get_selected_food_items_present( category_items) if (len(list_of_restaurant_categories) == 0): #print("Raising Exception") raise Validate_item_present() return list_of_restaurant_categories
def validate_item_available(restaurant_type): # print("///////////////////validate_item_available////////////////////") # print("In function validate_item_available") # print("In validate function class /Validate_item_available") list_of_item_available = ViewDB.get_food_items_availability( restaurant_type) if 'NA' in list_of_item_available: #print("Raising Exception") #return False raise Validate_item_available() else: #print("All Available validate function class /Validate_item_available") return True
def register(): print("Enter your choice:") print("a. Guest user:"******"b. Login") print("c. New Registration") choice = input("Enter your choice:") if choice == 'a': print("You are not eligible for discounts") city = input("Enter your city name:") area = input("Enter your area name:") Restaurants.restaurants() if choice == 'b': global is_registered_user is_registered_user = True # try: username = input("Enter the username:"******"First do the registration") register() # list_of_username=ViewDB.validate_username(username) # except: # pass if All_validations.validate(username) != False: password = input("Enter the password:"******"Reenter password or Forgot password? (R/F)") if input1 == 'R': print("Reenter password") i = 0 while (i < 3): username = input("Enter the username:"******"Enter the password:"******"please wait while you are redirected") city = ViewDB.login(username, password).get_city() area = ViewDB.login(username, password).get_area() print(city) print(area) Restaurants.restaurants() i += 1 print( "You have exceeded the number of attempts, please try resetting your password" ) register() elif input1 == 'F': flag = False print("Forgot password") question = ViewDB.check_question(username).get_question() print(question[0]) answer = input("Enter the answer:") ans = ViewDB.check_answer(username).get_answer() print(answer) print(ans) output_ans = ans[0] print(output_ans) if answer == output_ans: print("your answer is right") if ViewDB.security_question(username, answer): print("inside the security question") flag = True else: flag = False if flag == False: print("your answer is wrong") register() if flag == True: if correct_password(username) == True: pass if correct_password(username) == False: correct_password(username) # else: # register() else: register() # flag = 0 # print("Please check the password and type again") # flag = 1 # correct_password(username) # if flag == 0: # print("Your password does not meet the requirements, please refill them") if choice == 'c': name = input("Enter the username:"******"Username already exists!!!") name = input("Reenter the username:"******"Please give your input as a, b, or c only") register()
def register(): # print("Enter your choice:") print("a. Guest user:"******"b. Login") print("c. New Registration") choice = input("Enter your choice:") if choice == 'a': print("You are not eligible for discounts") FoodModule.Food.is_registered_user = False filtersearch.search_as_guest() if choice == 'b': # global is_registered_user # is_registered_user = True username = input("Enter the username:"******"First do the registration") register() if All_validations.validate(username) != False: password = input("Enter the password:"******"Reenter password or Forgot password? (R/F)") if input1 == 'R': print("Reenter password") i = 0 while (i < 3): username = input("Enter the username:"******"Enter the password:"******"please wait while you are redirected") city = ViewDB.login(username, password).get_city() area = ViewDB.login(username, password).get_area() #Storing Global FoodModule.Food.registered_user = username #Calling Module 2 Restaurants.restaurants(city, area) i += 1 print( "You have exceeded the number of attempts, please try resetting your password" ) register() elif input1 == 'F': flag = False print("Forgot password") question = ViewDB.check_question( username).get_question() print(question[0]) answer = input("Enter the answer:") ans = ViewDB.check_answer(username).get_answer() print(answer) print(ans) output_ans = ans[0] print(output_ans) if answer == output_ans: print("your answer is right") if ViewDB.security_question(username, answer): print("inside the security question") flag = True else: flag = False if flag == False: print("your answer is wrong") register() if flag == True: if correct_password(username) == True: relogin() if correct_password(username) == False: correct_password(username) else: register() else: register() if choice == 'c': name = input("Enter the username:"******"Username already exists!!!") name = input("Reenter the username:"******"Please give your input as a, b, or c only") register()
def validate_view(category): list_of_products = ViewDB.get_products(category) if (len(list_of_products) == 0): raise InvalidCategoryException() return list_of_products