Fix double-generation of scratch token (backport #6833) (#6835)

This commit is contained in:
SagePtr 2019-05-02 23:24:20 +02:00 committed by Lauris BH
parent d21dabab4e
commit 74eee64b57

View File

@ -129,11 +129,7 @@ func aesDecrypt(key, text []byte) ([]byte, error) {
// NewTwoFactor creates a new two-factor authentication token.
func NewTwoFactor(t *TwoFactor) error {
_, err := t.GenerateScratchToken()
if err != nil {
return err
}
_, err = x.Insert(t)
_, err := x.Insert(t)
return err
}