This commit is contained in:
Your Name 2023-10-07 10:23:51 -04:00
parent 39a1d3d6e0
commit 1885678995
1 changed files with 1 additions and 5 deletions

6
2fa.go
View File

@ -48,10 +48,6 @@ func Send2FA(u *UserData) error {
code := generate2fa() code := generate2fa()
u.Set("2fa", code) u.Set("2fa", code)
u.Set("2faexpires", fmt.Sprintf("%d", time.Now().Add(15*time.Minute).Unix())) u.Set("2faexpires", fmt.Sprintf("%d", time.Now().Add(15*time.Minute).Unix()))
email, ok := u.Get("email")
if !ok {
return errors.New("send2fa: no email")
}
firstname, ok := u.Get("firstname") firstname, ok := u.Get("firstname")
if !ok { if !ok {
return errors.New("send2fa: no firstname") return errors.New("send2fa: no firstname")
@ -61,6 +57,6 @@ func Send2FA(u *UserData) error {
return errors.New("send2fa: no lastname") return errors.New("send2fa: no lastname")
} }
fullname := fmt.Sprintf("%s %s", firstname, lastname) fullname := fmt.Sprintf("%s %s", firstname, lastname)
return Send2faEmail(email, fullname, code) return Send2faEmail(u.Username, fullname, code)
} }