MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / reset_password

Method reset_password

examples/loco_starter/src/models/users.rs:258–266  ·  view source on GitHub ↗

Resets the current user password with a new password and updates it in the database. This method hashes the provided password and sets it as the new password for the user. # Errors when has DB query error or could not hashed the given password

(
        mut self,
        db: &DatabaseConnection,
        password: &str,
    )

Source from the content-addressed store, hash-verified

256 ///
257 /// when has DB query error or could not hashed the given password
258 pub async fn reset_password(
259 mut self,
260 db: &DatabaseConnection,
261 password: &str,
262 ) -> ModelResult<Model> {
263 self.password =
264 ActiveValue::set(hash::hash_password(password).map_err(|e| ModelError::Any(e.into()))?);
265 Ok(self.update(db).await?)
266 }
267}

Callers 1

resetFunction · 0.45

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected