use of org.apache.openmeetings.web.app.OmAuthenticationStrategy in project openmeetings by apache.
the class SignInDialog method onSubmit.
@Override
protected void onSubmit(AjaxRequestTarget target) {
if (domain.getAddDomainToUserName()) {
login = login + "@" + domain.getDomain();
}
OmAuthenticationStrategy strategy = getAuthenticationStrategy();
WebSession ws = WebSession.get();
Type type = domain.getId() > 0 ? Type.ldap : Type.user;
boolean signIn = false;
try {
signIn = ws.signIn(login, password, type, domain.getId());
} catch (OmException e) {
error(getString(e.getKey()));
target.add(feedback);
}
if (signIn) {
setResponsePage(Application.get().getHomePage());
if (rememberMe) {
strategy.save(login, password, type, domain.getId());
} else {
strategy.remove();
}
} else {
if (!hasErrorMessage()) {
error(getString("error.bad.credentials"));
target.add(feedback);
}
// add random timeout
try {
Thread.sleep(6 + (long) (10 * Math.random() * 1000));
} catch (InterruptedException e) {
log.error("Unexpected exception while sleeping", e);
}
strategy.remove();
shake(target);
}
}
Aggregations