You can now login / change passwords / etc. again.
Fixed the installer. Shadow theme is still borked.
This commit is contained in:
parent
80ba8e2134
commit
55c10e0da2
|
@ -93,12 +93,6 @@ func (auth *DefaultAuth) Authenticate(username string, password string) (uid int
|
||||||
return 0, ErrSecretError
|
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)
|
err = CheckPassword(realPassword, password, salt)
|
||||||
if err == ErrMismatchedHashAndPassword {
|
if err == ErrMismatchedHashAndPassword {
|
||||||
return 0, ErrWrongPassword
|
return 0, ErrWrongPassword
|
||||||
|
@ -209,7 +203,7 @@ func CheckPassword(realPassword string, password string, salt string) (err error
|
||||||
blasted := strings.Split(realPassword, "$")
|
blasted := strings.Split(realPassword, "$")
|
||||||
prefix := blasted[0]
|
prefix := blasted[0]
|
||||||
if len(blasted) > 1 {
|
if len(blasted) > 1 {
|
||||||
prefix += blasted[1]
|
prefix += "$" + blasted[1] + "$"
|
||||||
}
|
}
|
||||||
algo, ok := HashPrefixes[prefix]
|
algo, ok := HashPrefixes[prefix]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
|
@ -18,7 +18,7 @@ func GenerateSafeString(length int) (string, error) {
|
||||||
|
|
||||||
// Generate a bcrypt hash
|
// Generate a bcrypt hash
|
||||||
// Note: The salt is in the hash, therefore the salt value is blank
|
// 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)
|
hashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", "", err
|
return "", "", err
|
||||||
|
|
Loading…
Reference in New Issue