From 2798d06c81480f8e71c11861c2c4c67966733cf6 Mon Sep 17 00:00:00 2001 From: c0repwn3r Date: Thu, 23 Feb 2023 14:43:24 -0500 Subject: [PATCH] full 2fa flow pt2 --- trifid-api/src/routes/v1/verify_totp_authenticator.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/trifid-api/src/routes/v1/verify_totp_authenticator.rs b/trifid-api/src/routes/v1/verify_totp_authenticator.rs index bdc0564..3aacd4c 100644 --- a/trifid-api/src/routes/v1/verify_totp_authenticator.rs +++ b/trifid-api/src/routes/v1/verify_totp_authenticator.rs @@ -39,7 +39,7 @@ pub struct VerifyTotpAuthenticatorResponse { pub metadata: VerifyTotpAuthenticatorResponseMetadata, } -#[options("/v1/auth/verify-totp-authenticator")] +#[options("/v1/verify-totp-authenticator")] pub async fn options() -> &'static str { "" } @@ -52,7 +52,7 @@ pub async fn verify_totp_authenticator_request(req: Json return Err((Status::Unauthorized, format!("{{\"errors\":[{{\"code\":\"{}\",\"message\":\"{} - {}\"}}]}}", "ERR_UNAUTHORIZED", "this token is invalid", e))) }; if !totpmachine.check_current(&req.0.code).unwrap() { - return Err((Status::Unauthorized, format!("{{\"errors\":[{{\"code\":\"{}\",\"message\":\"{}\",\"path\":\"totpToken\"}}]}}", "ERR_INVALID_TOTP_TOKEN", "TOTP token does not exist (maybe it expired?)"))) + return Err((Status::Unauthorized, format!("{{\"errors\":[{{\"code\":\"{}\",\"message\":\"{}\",\"path\":\"totpToken\"}}]}}", "ERR_INVALID_TOTP_CODE", "Invalid TOTP code"))) } match use_totp_token(req.0.totp_token, user.email, db.inner()).await { Ok(_) => (),