def login(): view.login() login_id = input().lower() new_login = model.Account(login_id) while not new_login.check_set_username(): view.does_not_exist() return login_terminal() new_login = new_login.set_from_username() view.enter_password() password = getpass.getpass() while not new_login.check_password((new_login.pass_hash), password): view.invalid_password() view.enter_password() password = getpass.getpass() login_menu(new_login)
def index(): if request.method == 'POST': login = request.form.get('login') password = request.form.get('password') return view.login(login, password) else: return view.home()
def POST(self): """ Comprueba si el usuario se puede logear y crea atributos para la sesión. """ import sys inputData = web.input() check = config.db.query("SELECT * FROM users where email=$username and password=$password", vars=inputData) if check: session.loggedin = True # User Data: session.userdata = db.userData(vars=inputData) # Insert table user_connections: insertID = db.insert_user_connections(session.userdata.id) #print "*"*100 #print #print "*"*100 #print >> sys.stderr, "Login Successful" raise web.seeother("/dashboard") else: #print >> sys.stderr, "Login Failed" return view.render.base(view.login("usuario o contraseña inválida"), "Login")
def run(): while True: choice = view.main_menu() if choice == "3": #Exit return elif choice == "1": #Create Account view.create_account() fname = view.first_name() lname = view.last_name() pin = view.choose_pin() initial = float(view.deposit_initial()) #Create new account then display view.new_account(model.create_account(fname, lname, pin, initial)) elif choice == "2": #log in account_num, pin = view.login() #Check if login info is correct if model.login(account_num, pin) == False: view.bad_login() else: #Login Menu - Check Balance, Withdraw, Deposit, Open Savings Account info = model.login(account_num, pin) view.welcome(account_num, info) while True: choice = view.login_menu() if choice == "1": view.check_balance(info) elif choice == "2": login_withdrawal(account_num) #see line 58 elif choice == "3": num = view.deposit() new_balance = model.deposit(num, account_num) view.deposit_new_balance(num, new_balance) elif choice == "4": from_account, to_account, amount = view.transfer() #Add " account" at the end of the string so it matches the key in the dictionary from_account = from_account + " account" to_account = to_account + " account" #convert amount value from string to float amount = float(amount) info = model.transfer(from_account, to_account, amount, account_num) view.transfer_new_balance(info, from_account, to_account) elif choice == "5": yesorno, deposit = view.create_savings() model.open_savings(yesorno, float(deposit), account_num) view.savings_opened(float(deposit)) elif choice == "6": view.signout() return else: view.bad_input()
def user(my_dict): while True: print(my_dict) view.welcome() user_input = view.user_choice() print(user_input) # if user_input == 3: # model.save(data) # return if user_input == 1: key = 'first name' f_name = view.first_name_prompt() my_dict[key] = f_name l_name = view.last_name_prompt() # new_account = view.account_creation(user_info) model.add_first_name(my_dict) model.add_last_name(my_dict) # model.add_pin() # model.add_confirm_pin() elif user_input == 2: view.login()
def login(): login_info = view.login() if not model.check_user(login_info[0]): print("No user found, please register!") _ = input('\n\nHit any key to retry') return elif not model.check_login(login_info[0], login_info[1]): print("Password is wrong, please retry") _ = input('\n\nHit any key to retry') return else: print("User %s login successfully" % login_info[0]) _ = input('\n\nHit any key to continue') return login_info[0]
def start(): selection = 0 while selection != 3: selection = v.mainmenu() if selection == 1: # Create account pin, first, last = v.create_account() newaccount = m.Account() newaccount.create_account(pin, first, last) v.create_acc_success(newaccount.account_num) start() if selection == 2: #Log in account_num, pin = v.login() account_num = str(account_num) account = m.Account(account_num) account_details = account.login(account_num, pin) if account != None: option = 0 while option != 4: option = v.account_options(account_details) if option == 1: # Show Balance v.show_balance(account.balance) elif option == 2:# Withdraw Funds amount = v.withdraw_funds() if account.withdraw(amount) == False: v.insufficient_funds else: v.withdraw_message(amount) v.show_balance(account.balance) elif option == 3:# Deposit Funds amount = v.deposit_funds() account.deposit(amount) v.show_balance(account.balance) start() # Back to create/login menu
def login_or_register(): bad_input = True while bad_input: user_input = view.login_or_register() acceptable_inputs = ['L','R'] if user_input.upper() in acceptable_inputs: if user_input.upper() == 'L': login_username, login_password = view.login() if login_username is False or login_password is False: print("Your login attempt failed. The username/password is not up to par...") break login_attempt_return_message, username_in_db, user_id = model.login(login_username, login_password) if login_attempt_return_message is not False: print("Welcome '{}', you are logged in!".format(username_in_db)) menu_after_login(login_username, user_id) break else: print("Your login attempt failed. The username/password does not exist...") break elif user_input.upper() == 'R': register_username, register_password = view.register() if register_username is False or register_password is False: print("Your registration attempt failed. The username/password is not up to par...") break perm = view.admin_perm() register_attempt = model.register(register_username,register_password,perm) if register_attempt: print("\nRegistration successful!") continue else: print('Registration attempt broken') else: print('login/register question broken') else: print('Hmm.. Invalid option')
def GET(self): """ Página de Login """ return view.render.base(view.login(), "Login")
#!C:\Python\python.exe print("Content-type: text/html\n\n") import view html = view.head() + view.login() + view.footer() print(html)