Skip to content

Instantly share code, notes, and snippets.

@cuongld2
Created March 16, 2020 09:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cuongld2/26f1648d0e3506535c6d158c426c130d to your computer and use it in GitHub Desktop.
Save cuongld2/26f1648d0e3506535c6d158c426c130d to your computer and use it in GitHub Desktop.
check if password is matched with bcrypt
def check_username_password(db: Session, user: schemas.UserAuthenticate):
db_user_info: models.UserInfo = get_user_by_username(db, username=user.username)
return bcrypt.checkpw(user.password.encode('utf-8'), db_user_info.password.encode('utf-8'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment