Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import bcrypt
from exrx.database import User
from exrx import app
@app.login_manager.user_loader
def load_user(user_id):
return User.query.filter_by(id=int(user_id)).first()
def validate_and_get_user(username, password):
user = User.query.filter_by(username=username).first()
if(not user):
return None
if bcrypt.checkpw(bytes(password,"utf-8"), user.password_hash):
return user
else:
return None