🐛 Authenticate wrong payload hotfix

This commit is contained in:
2024-06-26 18:07:07 +08:00
parent ab5130de2a
commit ebdb6f5688
4 changed files with 12 additions and 11 deletions

View File

@ -3,6 +3,7 @@ package services
import (
"fmt"
"github.com/samber/lo"
"strings"
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
@ -99,7 +100,7 @@ func CheckFactor(factor models.AuthFactor, code string) error {
)
case models.EmailPasswordFactor:
return lo.Ternary(
code == factor.Secret,
strings.ToUpper(code) == strings.ToUpper(factor.Secret),
nil,
fmt.Errorf("invalid verification code"),
)