mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-24 21:53:39 +09:00
fix: use clearer message for ldap auth failure (#39392)
* fix #34942 log: `user does not exist ...: not in LDAP database or invalid password`
This commit is contained in:
@@ -31,8 +31,9 @@ func (err ErrUserAlreadyExist) Unwrap() error {
|
||||
|
||||
// ErrUserNotExist represents a "UserNotExist" kind of error.
|
||||
type ErrUserNotExist struct {
|
||||
UID int64
|
||||
Name string
|
||||
UID int64
|
||||
Name string
|
||||
ExtraMsg string
|
||||
}
|
||||
|
||||
// IsErrUserNotExist checks if an error is a ErrUserNotExist.
|
||||
@@ -42,7 +43,11 @@ func IsErrUserNotExist(err error) bool {
|
||||
}
|
||||
|
||||
func (err ErrUserNotExist) Error() string {
|
||||
return fmt.Sprintf("user does not exist [uid: %d, name: %s]", err.UID, err.Name)
|
||||
ret := fmt.Sprintf("user does not exist [uid: %d, name: %s]", err.UID, err.Name)
|
||||
if err.ExtraMsg != "" {
|
||||
ret += ": " + err.ExtraMsg
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
// Unwrap unwraps this error as a ErrNotExist error
|
||||
|
||||
Reference in New Issue
Block a user