fix: reply with email already verified on attempted get request from account with verified email
All checks were successful
ci/woodpecker/push/build-and-publish Pipeline was successful
ci/woodpecker/push/publish-docs Pipeline was successful

This commit is contained in:
Radical 2025-07-06 01:57:21 +02:00
parent b00527633a
commit 000f798e25

View file

@ -26,8 +26,13 @@ struct Query {
///
/// ### Responses
/// 200 Success
///
/// 204 Already verified
///
/// 410 Token Expired
///
/// 404 Not Found
///
/// 401 Unauthorized
///
#[get("/verify-email")]
@ -46,6 +51,10 @@ pub async fn get(
let me = Me::get(&mut conn, uuid).await?;
if me.email_verified {
return Ok(HttpResponse::NoContent().finish());
}
let email_token = EmailToken::get(&data, me.uuid).await?;
if query.token != email_token.token {
@ -65,8 +74,11 @@ pub async fn get(
///
/// ### Responses
/// 200 Email sent
///
/// 204 Already verified
///
/// 429 Too Many Requests
///
/// 401 Unauthorized
///
#[post("/verify-email")]