fix: reply with email already verified on attempted get request from account with verified email
This commit is contained in:
parent
b00527633a
commit
000f798e25
1 changed files with 12 additions and 0 deletions
|
@ -26,8 +26,13 @@ struct Query {
|
||||||
///
|
///
|
||||||
/// ### Responses
|
/// ### Responses
|
||||||
/// 200 Success
|
/// 200 Success
|
||||||
|
///
|
||||||
|
/// 204 Already verified
|
||||||
|
///
|
||||||
/// 410 Token Expired
|
/// 410 Token Expired
|
||||||
|
///
|
||||||
/// 404 Not Found
|
/// 404 Not Found
|
||||||
|
///
|
||||||
/// 401 Unauthorized
|
/// 401 Unauthorized
|
||||||
///
|
///
|
||||||
#[get("/verify-email")]
|
#[get("/verify-email")]
|
||||||
|
@ -46,6 +51,10 @@ pub async fn get(
|
||||||
|
|
||||||
let me = Me::get(&mut conn, uuid).await?;
|
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?;
|
let email_token = EmailToken::get(&data, me.uuid).await?;
|
||||||
|
|
||||||
if query.token != email_token.token {
|
if query.token != email_token.token {
|
||||||
|
@ -65,8 +74,11 @@ pub async fn get(
|
||||||
///
|
///
|
||||||
/// ### Responses
|
/// ### Responses
|
||||||
/// 200 Email sent
|
/// 200 Email sent
|
||||||
|
///
|
||||||
/// 204 Already verified
|
/// 204 Already verified
|
||||||
|
///
|
||||||
/// 429 Too Many Requests
|
/// 429 Too Many Requests
|
||||||
|
///
|
||||||
/// 401 Unauthorized
|
/// 401 Unauthorized
|
||||||
///
|
///
|
||||||
#[post("/verify-email")]
|
#[post("/verify-email")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue