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

Function forgot

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

Source from the content-addressed store, hash-verified

89/// list).
90#[debug_handler]
91async fn forgot(
92 State(ctx): State<AppContext>,
93 Json(params): Json<ForgotParams>,
94) -> Result<Response> {
95 let Ok(user) = users::Model::find_by_email(&ctx.db, &params.email).await else {
96 // we don't want to expose our users email. if the email is invalid we still
97 // returning success to the caller
98 return format::json(());
99 };
100
101 let user = user
102 .into_active_model()
103 .set_forgot_password_sent(&ctx.db)
104 .await?;
105
106 AuthMailer::forgot_password(&ctx, &user).await?;
107
108 format::json(())
109}
110
111/// reset user password by the given parameters
112#[debug_handler]

Callers

nothing calls this directly

Calls 3

jsonFunction · 0.85
into_active_modelMethod · 0.80

Tested by

no test coverage detected