From cb439a126aa6a2728e423bcfd0d5e948337b8ddb Mon Sep 17 00:00:00 2001 From: ᴜɴᴋɴᴡᴏɴ Date: Tue, 14 Apr 2020 09:41:54 +0800 Subject: db: add tests for two factors (#6099) * Rename to TwoFactors.Create * Use GORM to execute queries * TwoFactor.GetByUserID * Add tests * Fix failing tests * Add MD5 tests * Add tests for RandomChars --- internal/route/repo/tasks.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/route/repo/tasks.go') diff --git a/internal/route/repo/tasks.go b/internal/route/repo/tasks.go index e06d3ee7..81e85e2a 100644 --- a/internal/route/repo/tasks.go +++ b/internal/route/repo/tasks.go @@ -10,8 +10,8 @@ import ( "gopkg.in/macaron.v1" log "unknwon.dev/clog/v2" + "gogs.io/gogs/internal/cryptoutil" "gogs.io/gogs/internal/db" - "gogs.io/gogs/internal/tool" ) func TriggerTask(c *macaron.Context) { @@ -39,7 +39,7 @@ func TriggerTask(c *macaron.Context) { // 🚨 SECURITY: No need to check existence of the repository if the client // can't even get the valid secret. Mostly likely not a legitimate request. - if secret != tool.MD5(owner.Salt) { + if secret != cryptoutil.MD5(owner.Salt) { c.Error(http.StatusBadRequest, "Invalid secret") return } -- cgit v1.2.3