feat: fix MFA bug, revert PR: "feat: don't send verification code if failed signin limit is reached" (#3627)

This commit is contained in:
hsluoyz
2025-03-01 12:58:28 +08:00
committed by GitHub
parent 41d9422687
commit cb1882e589
2 changed files with 7 additions and 12 deletions

View File

@ -60,7 +60,7 @@ type VerificationRecord struct {
IsUsed bool `xorm:"notnull" json:"isUsed"`
}
func IsAllowSend(user *User, remoteAddr, recordType, lang string) error {
func IsAllowSend(user *User, remoteAddr, recordType string) error {
var record VerificationRecord
record.RemoteAddr = remoteAddr
record.Type = recordType
@ -78,15 +78,10 @@ func IsAllowSend(user *User, remoteAddr, recordType, lang string) error {
return errors.New("you can only send one code in 60s")
}
err = checkSigninErrorTimes(user, lang)
if err != nil {
return err
}
return nil
}
func SendVerificationCodeToEmail(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string, lang string) error {
func SendVerificationCodeToEmail(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string) error {
sender := organization.DisplayName
title := provider.Title
@ -104,7 +99,7 @@ func SendVerificationCodeToEmail(organization *Organization, user *User, provide
}
content = strings.Replace(content, "%{user.friendlyName}", userString, 1)
err := IsAllowSend(user, remoteAddr, provider.Category, lang)
err := IsAllowSend(user, remoteAddr, provider.Category)
if err != nil {
return err
}
@ -122,8 +117,8 @@ func SendVerificationCodeToEmail(organization *Organization, user *User, provide
return nil
}
func SendVerificationCodeToPhone(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string, lang string) error {
err := IsAllowSend(user, remoteAddr, provider.Category, lang)
func SendVerificationCodeToPhone(organization *Organization, user *User, provider *Provider, remoteAddr string, dest string) error {
err := IsAllowSend(user, remoteAddr, provider.Category)
if err != nil {
return err
}