This commit is contained in:
@@ -6,14 +6,13 @@ package v1_6
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/models/migrations/base"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
"xorm.io/xorm"
|
||||
"gitea.dev/models/db"
|
||||
"gitea.dev/models/migrations/base"
|
||||
"gitea.dev/modules/timeutil"
|
||||
"gitea.dev/modules/util"
|
||||
)
|
||||
|
||||
func AddScratchHash(x *xorm.Engine) error {
|
||||
func AddScratchHash(x db.EngineMigration) error {
|
||||
// TwoFactor see models/twofactor.go
|
||||
type TwoFactor struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
@@ -51,10 +50,7 @@ func AddScratchHash(x *xorm.Engine) error {
|
||||
|
||||
for _, tfa := range tfas {
|
||||
// generate salt
|
||||
salt, err := util.CryptoRandomString(10)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
salt := util.CryptoRandomString(10)
|
||||
tfa.ScratchSalt = salt
|
||||
tfa.ScratchHash = base.HashToken(tfa.ScratchToken, salt)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user