From 74eee64b572bdbe322eca3f4836cd3ec973a5cd2 Mon Sep 17 00:00:00 2001 From: SagePtr Date: Thu, 2 May 2019 23:24:20 +0200 Subject: [PATCH] Fix double-generation of scratch token (backport #6833) (#6835) --- models/twofactor.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/models/twofactor.go b/models/twofactor.go index be37c50b4..7f260248b 100644 --- a/models/twofactor.go +++ b/models/twofactor.go @@ -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 }