Search in sources :

Example 1 with Credential

use of org.openremote.model.security.Credential in project openremote by openremote.

the class AdminUserEditActivity method handlePasswordReset.

protected void handlePasswordReset() {
    String password = adminContent.getPassword();
    String passwordControl = adminContent.getPasswordControl();
    adminContent.clearPassword();
    adminContent.clearPasswordControl();
    if (password == null)
        return;
    if (!password.equals(passwordControl)) {
        ConstraintViolation violation = new ConstraintViolation();
        violation.setConstraintType(ConstraintViolation.Type.FIELD);
        violation.setPath("password");
        violation.setMessage(environment.getMessages().passwordsMustMatch());
        validationErrorHandler.accept(new ConstraintViolation[] { violation });
        return;
    }
    Credential credential = new Credential(password, false);
    environment.getApp().getRequests().sendWith(credentialMapper, requestParams -> userResource.resetPassword(requestParams, realm, userId, credential), 204, () -> adminContent.addFormMessageSuccess(environment.getMessages().passwordUpdated()));
}
Also used : Credential(org.openremote.model.security.Credential) ConstraintViolation(org.openremote.model.http.ConstraintViolation)

Aggregations

ConstraintViolation (org.openremote.model.http.ConstraintViolation)1 Credential (org.openremote.model.security.Credential)1