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

Function verify

examples/loco_starter/src/controllers/auth.rs:69–84  ·  view source on GitHub ↗
(
    State(ctx): State<AppContext>,
    Json(params): Json<VerifyParams>,
)

Source from the content-addressed store, hash-verified

67/// the system.
68#[debug_handler]
69async fn verify(
70 State(ctx): State<AppContext>,
71 Json(params): Json<VerifyParams>,
72) -> Result<Response> {
73 let user = users::Model::find_by_verification_token(&ctx.db, &params.token).await?;
74
75 if user.email_verified_at.is_some() {
76 tracing::info!(pid = user.pid.to_string(), "user already verified");
77 } else {
78 let active_model = user.into_active_model();
79 let user = active_model.verified(&ctx.db).await?;
80 tracing::info!(pid = user.pid.to_string(), "user verified");
81 }
82
83 format::json(())
84}
85
86/// In case the user forgot his password this endpoints generate a forgot token
87/// and send email to the user. In case the email not found in our DB, we are

Callers

nothing calls this directly

Calls 3

jsonFunction · 0.85
into_active_modelMethod · 0.80
verifiedMethod · 0.45

Tested by

no test coverage detected