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

Function reset

examples/loco_seaography/src/controllers/auth.rs:113–126  ·  view source on GitHub ↗
(State(ctx): State<AppContext>, Json(params): Json<ResetParams>)

Source from the content-addressed store, hash-verified

111/// reset user password by the given parameters
112#[debug_handler]
113async fn reset(State(ctx): State<AppContext>, Json(params): Json<ResetParams>) -> Result<Response> {
114 let Ok(user) = users::Model::find_by_reset_token(&ctx.db, &params.token).await else {
115 // we don't want to expose our users email. if the email is invalid we still
116 // returning success to the caller
117 tracing::info!("reset token not found");
118
119 return format::json(());
120 };
121 user.into_active_model()
122 .reset_password(&ctx.db, &params.password)
123 .await?;
124
125 format::json(())
126}
127
128/// Creates a user login and returns a token
129#[debug_handler]

Callers

nothing calls this directly

Calls 3

jsonFunction · 0.85
into_active_modelMethod · 0.80
reset_passwordMethod · 0.45

Tested by

no test coverage detected