def login_func(): username = bottle.request.forms.get('username') password = bottle.request.forms.get('password') try: login.login_user(username, password) return bottle.static_file("success.html", root=".") except login.LoginError as error: return bottle.static_file("login.html", root=".")
def login(): from models import Usuarios from login import login_user, is_login if is_login(): return redirect(url_for("home")) form = formLogin() if form.validate_on_submit(): user = Usuarios.query.filter_by(username=form.username.data).first() if user != None and user.verify_password(form.password.data): login_user(user) return redirect(url_for('home')) form.username.errors.append("usuario o contraseña incorrecta") return render_template('login.html', form=form)
def login(self): try: if self.use_vpn and not os.path.isfile('cookies/{}_cookie.pkl'.format(self.username)): self.vpn_country = poweron_hola(self.browser, self.vpn_country) status, message = login_user(self.browser, self.username, self.password, self.switch_language, self.bypass_suspicious_attempt, self.verify_code_mail) if status is False and self.use_vpn is True and ("credentials" in message.lower() or "connect to Instagram" in message.lower() ): self.use_vpn = False print('[{}]\tTry again without VPN!'.format(self.username)) self.browser.delete_all_cookies() self.browser.quit() self.set_selenium_local_session() return self.login() else: return self.return_status(status, message) except TimeoutException as e: print("[Error]\t{}".format(e)) self.attempts + 1 if self.attempts <= 3: return self.login() else: raise Exception("Max attemps") except Exception as e: print("[Error]\t{}".format(e)) self.return_status(False, "Unable to login") self.screenshot(str(e))
def login(): # Here we use a class of some kind to represent and validate our # client-side form data. For example, WTForms is a library that will # handle this for us. form = LoginForm() if form.validate_on_submit(): # Login and validate the user. login_user(form.user) #, remember=True) flask.flash('Logged in successfully.') next = flask.request.args.get('next') #if not next_is_valid(next): # return flask.abort(400) return flask.redirect(next or '/') return flask.render_template('login.html', form=form)
def login(): form = LoginForm(request.form) if request.method == 'POST' and form.validate(): user = query.user.get_userLogin(form.username.data) try: if not user or not pbkdf2_sha256.verify(form.password.data, user["password"]): flash('Please check your login credentials and try again.') return redirect(url_for('Page.login')) if int(user["is_active"]) == 0: flash('Please active your user first.') return redirect(url_for('Page.login')) except: flash('Please check your login credentials and try again.') return redirect(url_for('Page.login')) login_user(user) return redirect(url_for('Page.graph_view')) return render_template("login.html", form=form, is_register=current_app.config["ALLOW_REGISTER"])
def login(): json = request.get_json(force=True) email = json.get('email') login_code = json.get('login_code') if not email: return make_response( 'Could not verify', 401, {'WWW-Authenticate': 'Basic realm ="Login required !!"'}) user = db.collection(u'users').document(email) # returns 401 if email is wrong if not (user.get()).exists: return make_response( 'Could not verify', 401, {'WWW-Authenticate': 'Basic realm ="User does not exist !!"'}) if not login_code or login_code == '': response = login_user(email, db) return make_response( jsonify({ "reason": response.reason, "text": response.text }), response.status_code) print(login_code) # if check_password_hash((user.get().to_dict().get(u'login_code')), login_code): if user.get().to_dict().get(u'login_code') == login_code: token = create_access_token(identity=email, expires_delta=datetime.timedelta(hours=24)) user.update({u'login_code': firestore.DELETE_FIELD}) return make_response(jsonify({'token': token, "user_id": email}), 201) # returns 403 if login code is wrong return make_response( 'Could not verify', 403, {'WWW-Authenticate': 'Basic realm ="Wrong Password !!"'})
from Window import window from login import login_user import os # #New code # #Comment this section out and uncomment Previous code to go to window directly #1------------------------------------# login = login_user(0) login.promptWindow.mainloop() #1end---------------------------------# # #Previous Code # #Comment this section out and uncomment New code to apply login window #2------------------------------------# # home = window(True) # home.root.mainloop() #2end---------------------------------#