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

Method reset_password

examples/loco_seaography/src/models/users.rs:262–270  ·  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

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

Callers 1

resetFunction · 0.45

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected