sending back a account_error errorcode for trying to log into a locked account. also, changing the domainId to domainname for this error

This commit is contained in:
abhishek 2010-12-08 16:10:18 -08:00
parent 61cf2308a1
commit 8ea2959f71
2 changed files with 9 additions and 4 deletions

View File

@ -180,8 +180,8 @@ public class ApiServlet extends HttpServlet {
try {
session.invalidate();
}catch (IllegalStateException ise) {}
auditTrailSb.append(" " + HttpServletResponse.SC_UNAUTHORIZED + " " + ex.getMessage() != null ? ex.getMessage() : "failed to authenticated user, check username/password are correct");
resp.sendError(HttpServletResponse.SC_UNAUTHORIZED, ex.getMessage() != null ? ex.getMessage() : "failed to authenticated user, check username/password are correct");
auditTrailSb.append(" " + BaseCmd.ACCOUNT_ERROR + " " + ex.getMessage() != null ? ex.getMessage() : "failed to authenticate user, check if username/password are correct");
resp.sendError(BaseCmd.ACCOUNT_ERROR, ex.getMessage() != null ? ex.getMessage() : "failed to authenticate user, check if username/password are correct");
return;
}
}

View File

@ -605,11 +605,16 @@ public class ManagementServerImpl implements ManagementServer {
return null;
}
DomainVO domain = _domainDao.findById(domainId);
String domainName = null;
if(domain != null)
domainName = domain.getName();
if (!userAccount.getState().equals("enabled") || !userAccount.getAccountState().equals("enabled")) {
if (s_logger.isInfoEnabled()) {
s_logger.info("user " + username + " in domain " + domainId + " is disabled/locked (or account is disabled/locked), returning null");
s_logger.info("User " + username + " in domain " + domainName + " is disabled/locked (or account is disabled/locked)");
}
throw new CloudAuthenticationException("user " + username + " in domain " + domainId + " is disabled/locked (or account is disabled/locked)");
throw new CloudAuthenticationException("User " + username + " in domain " + domainName + " is disabled/locked (or account is disabled/locked)");
//return null;
}