This commit is contained in:
Your Name 2023-10-09 11:29:07 -04:00
parent 4f581d156b
commit d99a72ff82
1 changed files with 8 additions and 2 deletions

10
2fa.go
View File

@ -47,8 +47,14 @@ func Send2FA(u *UserData) error {
code := generate2fa()
u.Set("2fa", code)
u.Set("2faexpires", fmt.Sprintf("%d", time.Now().Add(15*time.Minute).Unix()))
firstname, _ := u.Get("firstname")
lastname, _ := u.Get("lastname")
firstname, ok := u.Get("firstname")
if !ok {
firstname = ""
}
lastname, ok := u.Get("lastname")
if !ok {
lastname = ""
}
fullname := fmt.Sprintf("%s %s", firstname, lastname)
return Send2faEmail(u.Username, fullname, code)