Search in sources :

Example 1 with Type

use of org.apache.openmeetings.db.entity.user.User.Type in project openmeetings by apache.

the class UserDTO method get.

public static UserDTO get(JSONObject o) {
    if (o == null) {
        return null;
    }
    UserDTO u = new UserDTO();
    u.id = optLong(o, "id");
    u.login = o.optString("login");
    u.password = o.optString("password");
    u.firstname = o.optString("firstname");
    u.lastname = o.optString("lastname");
    u.rights.addAll(optEnumList(Right.class, o.optJSONArray("rights")));
    u.languageId = o.optLong("languageId");
    JSONObject a = o.optJSONObject("address");
    if (a != null) {
        u.address.setId(optLong(a, "id"));
        u.address.setCountry(a.optString("country"));
        u.address.setEmail(a.optString("email"));
    }
    u.timeZoneId = o.optString("timeZoneId");
    u.externalId = o.optString("externalId");
    u.externalType = o.optString("externalType");
    u.type = optEnum(Type.class, o, "type");
    return u;
}
Also used : Type(org.apache.openmeetings.db.entity.user.User.Type) JSONObject(com.github.openjson.JSONObject) Right(org.apache.openmeetings.db.entity.user.User.Right)

Example 2 with Type

use of org.apache.openmeetings.db.entity.user.User.Type 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)2 JSONObject (com.github.openjson.JSONObject)1 Right (org.apache.openmeetings.db.entity.user.User.Right)1 OmException (org.apache.openmeetings.util.OmException)1 OmAuthenticationStrategy (org.apache.openmeetings.web.app.OmAuthenticationStrategy)1 WebSession (org.apache.openmeetings.web.app.WebSession)1