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