Display proper error message when LDAP is unavailable
At the moment the error message 'Incorrect username or password.' is displayed when querying the LDAP server fails because it is unavailable. This message is misleading since the user cannot make the login succeed by correcting the username or password. With this change now a proper error message is displayed so that the user can understand that login is not possible due to the LDAP server not being available. Change-Id: I4afa503642537dbdb33c1031220281f923dddfc8 Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
@@ -14,7 +14,40 @@
|
||||
|
||||
package com.google.gerrit.common.auth.userpass;
|
||||
|
||||
import com.google.gerrit.reviewdb.AuthType;
|
||||
|
||||
public class LoginResult {
|
||||
public boolean success;
|
||||
public boolean isNew;
|
||||
|
||||
protected AuthType authType;
|
||||
protected Error error;
|
||||
|
||||
protected LoginResult() {
|
||||
}
|
||||
|
||||
public LoginResult(final AuthType authType) {
|
||||
this.authType = authType;
|
||||
}
|
||||
|
||||
public AuthType getAuthType() {
|
||||
return authType;
|
||||
}
|
||||
|
||||
public void setError(final Error error) {
|
||||
this.error = error;
|
||||
success = error == null;
|
||||
}
|
||||
|
||||
public Error getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public static enum Error {
|
||||
/** Username or password are invalid */
|
||||
INVALID_LOGIN,
|
||||
|
||||
/** The authentication server is unavailable or the query to it timed out */
|
||||
AUTHENTICATION_UNAVAILABLE
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user