Diffstat (limited to 'internal/router/handlers/api-v1-email-verify.go')
| -rw-r--r-- | internal/router/handlers/api-v1-email-verify.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/internal/router/handlers/api-v1-email-verify.go b/internal/router/handlers/api-v1-email-verify.go index 65ad6d9..c9ec969 100644 --- a/internal/router/handlers/api-v1-email-verify.go +++ b/internal/router/handlers/api-v1-email-verify.go @@ -5,7 +5,6 @@ import ( "log/slog" "github.com/SayaAndy/saya-today-web/internal/router" - "github.com/SayaAndy/saya-today-web/l10n" "github.com/gofiber/fiber/v2" ) @@ -37,29 +36,25 @@ func (r *VerifyCodeHandler) ToValidateLang() router.LangSetting { return router.InReferer } -func (r *VerifyCodeHandler) RateLimiter() *fiber.Handler { - return &router.RateLimiterStrict -} - func (r *VerifyCodeHandler) Render(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (statusCode int, err error) { verificationCode := c.FormValue("email_code") templateMap["StatusId"] = "verification-message" if verificationCode == "" { templateMap["Status"] = "Failed" - templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "VerificationEmpty").(string) + templateMap["Message"] = supplements.Localization[lang].UserProfile.VerificationEmpty return fiber.StatusUnprocessableEntity, nil } if err = supplements.Mailer.Verify(verificationCode, lang); err != nil { slog.Warn("verification code is invalid", slog.String("verification_code", verificationCode), slog.String("error", err.Error())) templateMap["Status"] = "Failed" - templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "VerificationFailed").(string) + templateMap["Message"] = supplements.Localization[lang].UserProfile.VerificationFailed return fiber.StatusUnprocessableEntity, nil } templateMap["Status"] = "OK" - templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "VerificationSuccess").(string) + templateMap["Message"] = supplements.Localization[lang].UserProfile.VerificationSuccess templateMap["DataAttributes"] = map[string]any{ "hide-verification-panel": template.HTMLAttr("data-code-expiry-time=\"true\""), } |