Esempio n. 1
0
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()
Esempio n. 2
0
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()