more
This commit is contained in:
parent
4f581d156b
commit
d99a72ff82
10
2fa.go
10
2fa.go
|
@ -47,8 +47,14 @@ 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, _ := u.Get("firstname")
|
firstname, ok := u.Get("firstname")
|
||||||
lastname, _ := u.Get("lastname")
|
if !ok {
|
||||||
|
firstname = ""
|
||||||
|
}
|
||||||
|
lastname, ok := u.Get("lastname")
|
||||||
|
if !ok {
|
||||||
|
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