- Fix arr setup getting thr wrong crendentials - Add file link invalidator - Other minor bug fixes
20 lines
414 B
Go
20 lines
414 B
Go
package config
|
|
|
|
import "golang.org/x/crypto/bcrypt"
|
|
|
|
func VerifyAuth(username, password string) bool {
|
|
// If you're storing hashed password, use bcrypt to compare
|
|
if username == "" {
|
|
return false
|
|
}
|
|
auth := Get().GetAuth()
|
|
if auth == nil {
|
|
return false
|
|
}
|
|
if username != auth.Username {
|
|
return false
|
|
}
|
|
err := bcrypt.CompareHashAndPassword([]byte(auth.Password), []byte(password))
|
|
return err == nil
|
|
}
|