fix(dimentorin): verify-email validates OTP before activating user

- new app_otp_cache table + OtpCache entity (ResourceEnum::OtpCache)
- PostgresOtpRepository upsert/find/delete keyed by email
- register/resend persist otp_hash+expiry after email sent (no orphan OTP)
- verify_email validates via OtpManager::validate_otp_hash, single-use delete
- 8 unit tests pass, e2e verified: wrong OTP 400, correct OTP 200
This commit is contained in:
asepharyana
2026-08-04 23:35:34 +07:00
parent 3692b81324
commit c6ed5c5c19
12 changed files with 240 additions and 18 deletions
+1
View File
@@ -39,6 +39,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.await?;
drop_and_create_table(&db, builder, "rate_limits", common::rate_limit::Entity)
.await?;
drop_and_create_table(&db, builder, "otp_cache", common::otp_cache::Entity).await?;
drop_and_create_table(&db, builder, "gacha_credits", gacha::gacha_credits::Entity)
.await?;