From 55c10e0da236b04ec8f6c0edf4c7fc7c896b74d4 Mon Sep 17 00:00:00 2001 From: Azareal Date: Sun, 27 May 2018 20:16:43 +1000 Subject: [PATCH] You can now login / change passwords / etc. again. Fixed the installer. Shadow theme is still borked. --- common/auth.go | 8 +------- install/install/utils.go | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/common/auth.go b/common/auth.go index 7e97d6bb..7d3c9949 100644 --- a/common/auth.go +++ b/common/auth.go @@ -93,12 +93,6 @@ func (auth *DefaultAuth) Authenticate(username string, password string) (uid int return 0, ErrSecretError } - if salt == "" { - // Send an email to admin for this? - LogError(errors.New("Missing salt for user #" + strconv.Itoa(uid) + ". Potential security breach.")) - return 0, ErrSecretError - } - err = CheckPassword(realPassword, password, salt) if err == ErrMismatchedHashAndPassword { return 0, ErrWrongPassword @@ -209,7 +203,7 @@ func CheckPassword(realPassword string, password string, salt string) (err error blasted := strings.Split(realPassword, "$") prefix := blasted[0] if len(blasted) > 1 { - prefix += blasted[1] + prefix += "$" + blasted[1] + "$" } algo, ok := HashPrefixes[prefix] if !ok { diff --git a/install/install/utils.go b/install/install/utils.go index 16c33284..12567caf 100644 --- a/install/install/utils.go +++ b/install/install/utils.go @@ -18,7 +18,7 @@ func GenerateSafeString(length int) (string, error) { // Generate a bcrypt hash // Note: The salt is in the hash, therefore the salt value is blank -func bcryptGeneratePassword(password string) (hash string, salt string, err error) { +func BcryptGeneratePassword(password string) (hash string, salt string, err error) { hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost) if err != nil { return "", "", err