This commit is contained in:
Your Name 2023-10-09 11:12:51 -04:00
parent f809500d17
commit 4f581d156b
1 changed files with 2 additions and 9 deletions

11
2fa.go
View File

@ -2,7 +2,6 @@ package scsusers
import (
"crypto/rand"
"errors"
"fmt"
"math/big"
"strconv"
@ -48,14 +47,8 @@ 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, ok := u.Get("firstname")
if !ok {
return errors.New("send2fa: no firstname")
}
lastname, ok := u.Get("lastname")
if !ok {
return errors.New("send2fa: no lastname")
}
firstname, _ := u.Get("firstname")
lastname, _ := u.Get("lastname")
fullname := fmt.Sprintf("%s %s", firstname, lastname)
return Send2faEmail(u.Username, fullname, code)