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
|
||||
/// 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")]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue