summaryrefslogtreecommitdiff
path: root/internal/authentication/file_user_provider.go
diff options
context:
space:
mode:
authorClement Michaud <clement.michaud34@gmail.com>2019-12-27 17:55:00 +0100
committerClément Michaud <clement.michaud34@gmail.com>2019-12-28 09:08:54 +0100
commit1ee442e86f76ed368f96fcdcbded9bd724bab579 (patch)
treeafb56d085f60a66ac37ad34138e06c5ba6cc33b9 /internal/authentication/file_user_provider.go
parentd037fb2728ae41c026485d34017bb2c4dcd4a3c8 (diff)
Improve logs of password hashing to help troubleshoot issues.
Diffstat (limited to 'internal/authentication/file_user_provider.go')
-rw-r--r--internal/authentication/file_user_provider.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/internal/authentication/file_user_provider.go b/internal/authentication/file_user_provider.go
index 9882eee71..e8511fe32 100644
--- a/internal/authentication/file_user_provider.go
+++ b/internal/authentication/file_user_provider.go
@@ -3,6 +3,7 @@ package authentication
import (
"fmt"
"io/ioutil"
+ "strings"
"sync"
"github.com/asaskevich/govalidator"
@@ -68,7 +69,7 @@ func readDatabase(path string) (*DatabaseModel, error) {
// CheckUserPassword checks if provided password matches for the given user.
func (p *FileUserProvider) CheckUserPassword(username string, password string) (bool, error) {
if details, ok := p.database.Users[username]; ok {
- hashedPassword := details.HashedPassword[7:] // Remove {CRYPT}
+ hashedPassword := strings.ReplaceAll(details.HashedPassword, "{CRYPT}", "")
ok, err := CheckPassword(password, hashedPassword)
if err != nil {
return false, err