more
This commit is contained in:
parent
f809500d17
commit
4f581d156b
11
2fa.go
11
2fa.go
|
@ -2,7 +2,6 @@ package scsusers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
@ -48,14 +47,8 @@ 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()))
|
||||||
firstname, ok := u.Get("firstname")
|
firstname, _ := u.Get("firstname")
|
||||||
if !ok {
|
lastname, _ := u.Get("lastname")
|
||||||
return errors.New("send2fa: no firstname")
|
|
||||||
}
|
|
||||||
lastname, ok := u.Get("lastname")
|
|
||||||
if !ok {
|
|
||||||
return errors.New("send2fa: no lastname")
|
|
||||||
}
|
|
||||||
fullname := fmt.Sprintf("%s %s", firstname, lastname)
|
fullname := fmt.Sprintf("%s %s", firstname, lastname)
|
||||||
return Send2faEmail(u.Username, fullname, code)
|
return Send2faEmail(u.Username, fullname, code)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue