From 4f581d156b7572f9553ecbd65ebd4ac9d048544e Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 9 Oct 2023 11:12:51 -0400 Subject: [PATCH] more --- 2fa.go | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/2fa.go b/2fa.go index 797731a..bc498cf 100644 --- a/2fa.go +++ b/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)