def login(): if request.method == 'GET': return render_template('login.html') else: email = request.form.get('email') password = request.form.get('password') remember = True user = models.Client.query.filter_by(email=email).first() if not user and not check_password_hash(user.password, password): # flash('Please check your login details and try again.') return redirect(url_for('login')) login_user(user, remember=remember) return redirect(url_for('index'))
def check_password(self, password): return check_password_hash(self.password_hash, password)
def validate_oldpassword(self, oldpassword): #check if the old password matches if not check_password_hash(self.old_password_hash, self.oldpassword.data): raise ValidationError('Old Password not correct')
def verifica_senha(self, senhaTemp): check_password_hash(self.senha, senhaTemp) return generate_password_hash(senhaTemp)