From 28137b3048cfc6ef01c2e6895870c14e0047b890 Mon Sep 17 00:00:00 2001 From: Ben Schumacher Date: Fri, 6 Aug 2021 11:52:01 +0200 Subject: [PATCH] Remove deprecated model.ComparePassword method (#18069) --- model/user.go | 12 ------------ model/user_test.go | 7 ------- 2 files changed, 19 deletions(-) diff --git a/model/user.go b/model/user.go index 6ab414ff61..d896401afd 100644 --- a/model/user.go +++ b/model/user.go @@ -854,18 +854,6 @@ func HashPassword(password string) string { return string(hash) } -// ComparePassword compares the hash -// This function is deprecated and will be removed in a future release. -func ComparePassword(hash string, password string) bool { - - if password == "" || hash == "" { - return false - } - - err := bcrypt.CompareHashAndPassword([]byte(hash), []byte(password)) - return err == nil -} - var validUsernameChars = regexp.MustCompile(`^[a-z0-9\.\-_]+$`) var validUsernameCharsForRemote = regexp.MustCompile(`^[a-z0-9\.\-_:]+$`) diff --git a/model/user_test.go b/model/user_test.go index 32f271a867..0dc1cd9d13 100644 --- a/model/user_test.go +++ b/model/user_test.go @@ -13,13 +13,6 @@ import ( "github.com/stretchr/testify/require" ) -func TestPasswordHash(t *testing.T) { - hash := HashPassword("Test") - - assert.True(t, ComparePassword(hash, "Test"), "Passwords don't match") - assert.False(t, ComparePassword(hash, "Test2"), "Passwords should not have matched") -} - func TestUserDeepCopy(t *testing.T) { id := NewId() authData := "authdata"