Function update_user_security

Source
pub async fn update_user_security(
    pool: &Pool<MySql>,
    id: i64,
    password: Option<&str>,
    salt: Option<&str>,
    two_factor_enabled: Option<bool>,
    two_factor_verified: Option<bool>,
) -> Result<User>
Expand description

Updates a user’s security settings.

This function updates security-related fields in the users table.

§Arguments

  • pool - Database connection pool for executing the query
  • id - Unique identifier of the user
  • password - Optional new password (should be pre-hashed)
  • salt - Optional new salt (should be provided if password is)
  • two_factor_enabled - Optional flag to enable/disable two-factor authentication
  • two_factor_verified - Optional flag indicating 2FA verification status

§Returns

  • Ok(User) - Successfully updated user security settings
  • Err(anyhow::Error) - Failed to update user security settings