Skip to main content

verify_user_credentials

Function verify_user_credentials 

Source
async fn verify_user_credentials(
    db: &DB,
    username_or_email: &str,
    password: &str,
) -> Result<User, (StatusCode, String)>
Expand description

Verifies user credentials (username/email and password) against the database

  • db - A reference to the database connection
  • username_or_email - The username or email provided by the user
  • password - The password provided by the user

ยงReturns

  • Ok(User) - The User struct if the credentials are valid
  • Err((StatusCode, String)) - A tuple containing the HTTP status code and an error message if the credentials are invalid