mirror of
https://github.com/Pacerino/CaddyProxyManager.git
synced 2026-07-29 08:52:58 -04:00
small changes to error codes and behavior
This commit is contained in:
@@ -41,7 +41,7 @@ func (s Handler) UserLogin() func(http.ResponseWriter, *http.Request) {
|
||||
return
|
||||
} else {
|
||||
// if the user was found but there is an error, throw it also
|
||||
h.ResultErrorJSON(w, r, http.StatusBadGateway, err.Error(), nil)
|
||||
h.ResultErrorJSON(w, r, http.StatusUnauthorized, err.Error(), nil)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ func PeformLogin(email, pass string) (GeneratedResponse, error) {
|
||||
// Compare stored PW and given PW
|
||||
err = bcrypt.CompareHashAndPassword([]byte(user.Secret), []byte(pass))
|
||||
if err != nil {
|
||||
return GeneratedResponse{}, errors.New("username or Password is wrong")
|
||||
return GeneratedResponse{}, errors.New("username or password is wrong")
|
||||
}
|
||||
// Everything seems legit, generate JWT
|
||||
jwtData, err := Generate(&user)
|
||||
|
||||
Reference in New Issue
Block a user