(
State(ctx): State<AppContext>,
Json(params): Json<VerifyParams>,
)
| 67 | /// the system. |
| 68 | #[debug_handler] |
| 69 | async 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, ¶ms.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 |
nothing calls this directly
no test coverage detected