more
This commit is contained in:
parent
f809500d17
commit
4f581d156b
11
2fa.go
11
2fa.go
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue