def main_menu(): init(autoreset=True) # var initiation user_input = 0 while user_input != 3: user_input = input(Fore.RED + '''\nWhat would you like to do?\n 1. Login 2. Create a new account 3. Quit app\n >> ''') # validating user_input try: user_input = int(user_input) except ValueError: print(Fore.RED + Style.BRIGHT + '\nINVALID OPTION, TRY AGAIN!\n') if isinstance(user_input, int) == True: # login if user_input == 1: username = str(input('\nPlease enter your username: '******'Please enter your password: '******'\nLogin successful!') if username != 'admin': login_menu(username) else: admin_menu() pass else: print(Fore.RED + Style.BRIGHT + '\nINVALID LOGIN!') else: print(Fore.RED + Style.BRIGHT + '\nPlease check your username or password!') # signup elif user_input == 2: username = str(input('\nPlease enter your username: '******'Please enter your password: '******'Please enter your full name: ')) hashed = hashpw(password.encode(), gensalt()) if controller.create_account(username, hashed, name) == 1: print(Fore.GREEN + Style.BRIGHT + '\nAccount creation successful!') else: print(Fore.RED + Style.BRIGHT + 'Account creation failed\n') # quit elif user_input == 3: print(Fore.CYAN + Style.BRIGHT + 'Thank you for checking this game out! Goodbye :)') break # invalid option elif user_input > 3: print(Fore.RED + Style.BRIGHT + '\nINVALID OPTION, TRY AGAIN!\n')
def login(): content = request.get_json() email = content['email'] password = sha512(content['password']).hexdigest() result = co.login(email, password) a = '"email": "0"' if result.find(a) != -1: return result, 400 else: return result, 200
def login(): username = input("Enter the username : "******"Enter the password : "******"Wrong Username or Password!! Please check the username and password again..") return (None, None) else: if(pw != password): pw = None return uid, pw
def login(): while True: email = input("Enter your email: ") if email.find('@') != -1: break print("Invalid email") password = stdiomask.getpass("Enter password:") result = controller.login(email, password) if isinstance(result, str): print(result) return loginSuccess(result)
def get_audio(): logging.info(f"Loin with email '{C.EMAIL}' and password '{C.PASSWORD}'") access_token = login(C.EMAIL, C.PASSWORD) if access_token is None: logging.error("Can't log-in!!") return None with open(f"{root_path}{C.DATA_FILE}") as jsonfile: data = json.load(jsonfile) loop = asyncio.new_event_loop() asyncio.set_event_loop(loop) loop.run_until_complete(get_all_audio(access_token, data)) logging.info("Load audio sucess")
def login_view(self): import controller message = "" if session.get("username"): if int(session.get("n_orders")) > 1: return redirect(url_for('DashboardView:checkout_view')) else: return redirect(url_for('DashboardView:home_view')) else: if request.method == 'POST': username = request.form.get("username") password = request.form.get("password") login_status = controller.login(username, password) if login_status == "success": session["username"] = username if session.get("n_orders"): return redirect(url_for('DashboardView:checkout_view')) else: return redirect(url_for('DashboardView:home_view')) else: message = login_status return render_template('login.html', message=message) return render_template("login.html", message=message)
print(" | Abraham Gutierrez #19111 |") print(" |_______________________________| \n") user_data = {} subscription = {} while True: print("Ingrese una de las siguientes opciones: ") o = input("\t1) Login \n\t2) Registrarse\n") if (o == "1"): print("\nPor favor ingrese sus credenciales.") usuario = input("Usuario: ") contra = input("Contraseña: ") user_data = controller.login(usuario, contra) if (user_data): if (user_data['enabled'] == True): print("\n/ * Bienvenido ", user_data['username'], " * /") notificacion = controller.getNotified(user_data['id_user']) if (notificacion is not None): print("\n\t>>Te recomendamos esta rolona: ") print('\t>>', notificacion['song_name'], ' - ', notificacion['art_name']) break else: print("Usted esta deshabilitado...\n") else: print("\nCredenciales incorrectos.\n") elif (o == "2"):
def login(): controller.login()
def login(): return con.login()
def auth(): auth = request.args response = controller.login(auth['username'], auth['password']) code = 200 return jsonify(response)
import db import controller import pyplots print "Welcome to Expense Manager!" print "1. Login" print "2. New user. Register?" print "3. Exit" ch = input("your choice : ") if ch == 1: b, user = controller.login() if b is True: print "FEATURE LIST:" print "1. ADD EXPENSES TO YOUR EXPENSE DATABASE" print "2. RETRIEVE EXPENSES FROM YOUR EXPENSE DATABASE" print "3. EXIT" ch1 = input("Your choice : ") while ch1 != 3: if ch1 == 1: controller.add_entry(user) print "The expense added successfully" elif ch1 == 2: print "SUB-MENU:" print "1. GET EXPENSES FOR MONTHS" print "2. GET EXPENSES FOR A YEAR" print "3. GET EXPENSES FOR A PERIOD"
def logged_menu(logged_user): print("Welcome you are logged in as: " + logged_user.username) while True: command = input("Logged>>") if command == 'info': print("You are: " + logged_user.username) print("Your id is: " + str(logged_user.id_)) print("Your balance is:" + str(logged_user.balance) + '$') elif command == 'changepass': new_pass = input("Enter your new password: "******"Enter your new password: "******"Enter your new message: ") logged_user.message = new_message elif command == 'show-message': print(logged_user.message) elif command.startswith('deposit'): amount = command.split()[-1] try: amount = float(amount) tan_code = input(">Enter TAN code: ") if not controller.is_valid_tan_code(logged_user, tan_code): print('Invalid TAN code!') return controller.deposit_money(logged_user, amount) controller.consume_tan_code(tan_code) print('{:.2f} was successfully added to your account!'.format( amount)) except ValueError: print('Invalid deposit amount!') elif command.startswith('withdraw'): amount = command.split()[-1] try: amount = float(amount) tan_code = input(">Enter TAN code: ") if not controller.is_valid_tan_code(logged_user, tan_code): print('Invalid TAN code!') else: did_withdraw = controller.withdraw_money( logged_user, amount) if did_withdraw: controller.consume_tan_code(tan_code) print( '{:.2f} was successfully withdrawn to your account!' .format(amount)) except ValueError: print('Invalid withdraw amount!') elif command == 'generate-tan-codes': password = input("Enter your password: "******"Login failed") elif command == 'display-balance': print(logged_user.balance) elif command == 'help': print("info - for showing account info") print('deposit <amount> - for depositing money') print('withdraw <amount> - for withdrawing money') print("changepass - for changing passowrd") print("change-message - for changing users message") print("show-message - for showing users message") print("display-balance - for displaying your current balance") print( "generate-tan-codes - generates and sends 10 TAN codes to your e-mail" )
def main_menu(): print( "Welcome to our bank service. You are not logged in. \nPlease register or login" ) while True: command = input("$$$>") if command == 'register': username = input("Enter your username: "******"Enter your password: "******"Enter your password: "******"Registration Successful") elif command == 'login': username = input("Enter your username: "******"Enter your password: "******"Login failed") elif command.startswith('send-reset-password'): username = command[20:] user_exists, user = validate_user(username) if not user_exists: print('No user with the username {} exists!'.format(username)) reset_token = generate_password_reset_token() email_was_sent = send_password_reset_token(user, reset_token) if not email_was_sent: print('There was an error with sending the e-mail!') return user.reset_code = reset_token elif command.startswith('reset-password'): username = command[15:] user_exists, user = validate_user(username) if not user_exists: print('No user with the username {} exists!'.format(username)) return reset_token = user.reset_code if not reset_token: print('There is no reset token for the user!') return given_reset_token = input('Please enter your reset token: ') if given_reset_token != reset_token: print('Invalid reset token!') return new_password = input('Enter your new password: '******'Enter your new password: '******'' user.password = new_password print('You have successfully reset your password!') elif command == 'help': print("login - for logging in!") print("register - for creating new account!") print("exit - for closing program!") elif command == 'exit': return else: print("Not a valid command")
def login(): return jsonify(control.login(request.form))
def login(request): """ 登入 """ return controller.login(request)