summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagePtr <sageptr@gmail.com>2019-05-02 22:06:01 +0200
committerLauris BH <lauris@nix.lv>2019-05-02 23:06:01 +0300
commit59f879bfec2c13555921f6373517b393db3d65b4 (patch)
tree005a753909ebb5b3b3dfa36b795805e917bc1938
parentade88a877d7f3c1fba466359198b8aa8ce5f28f8 (diff)
downloadgitea-59f879bfec2c13555921f6373517b393db3d65b4.tar.gz
gitea-59f879bfec2c13555921f6373517b393db3d65b4.zip
Fix double-generation of scratch token (#6832) (#6833)
-rw-r--r--models/twofactor.go6
1 files changed, 1 insertions, 5 deletions
diff --git a/models/twofactor.go b/models/twofactor.go
index be37c50b46..7f260248bc 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
}