public int login(WGDatabase db, String username, String password) throws WGAPIException {
String domain = (String) db.getAttribute(WGACore.DBATTRIB_DOMAIN);
DomainConfiguration domainConfig = _core.getDomainConfig(domain);
LoginAttemptInformation inf = getLoginAttemptInformation(domain, username);
if (inf != null && inf.isBlocked()) {
LOG.warn("Failed login for '" + username + "': Username is blocked because of too many wrong login attempts (Brute force login blocker on database " + db.getDbReference() + ")");
return WGDatabase.ACCESSLEVEL_NOTLOGGEDIN;
}
int level = (db.isSessionOpen() ? db.reopenSession(username, password) : db.openSession(username, password));
if (level == WGDatabase.ACCESSLEVEL_NOTLOGGEDIN) {
if (inf == null) {
inf = new LoginAttemptInformation(domain, username, domainConfig.getMaximumLoginAttempts());
inf.map(_failedLoginAttempts);
}
inf.addFailedAttempt();
if (inf.isBlocked()) {