Search in sources :

Example 1 with OmAuthenticationStrategy

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);
    }
}
Also used : Type(org.apache.openmeetings.db.entity.user.User.Type) WebSession(org.apache.openmeetings.web.app.WebSession) OmException(org.apache.openmeetings.util.OmException) OmAuthenticationStrategy(org.apache.openmeetings.web.app.OmAuthenticationStrategy)

Aggregations

Type (org.apache.openmeetings.db.entity.user.User.Type)1 OmException (org.apache.openmeetings.util.OmException)1 OmAuthenticationStrategy (org.apache.openmeetings.web.app.OmAuthenticationStrategy)1 WebSession (org.apache.openmeetings.web.app.WebSession)1