final Object userNameValue = userNameExpression.getValue(elContext);
if (userNameValue == null) {
context.setError("Error creating user", "The user name value is null");
return;
}
final User user = new User(userNameValue.toString());
if (passwordExpression != null) {
final Object passwordValue = passwordExpression.getValue(elContext);
if (passwordValue == null) {
context.setError("Error creating user", "The password value is null");
return;
}
if (passwordConfirmExpression != null) {
final Object passwordConfirmValue = passwordConfirmExpression.getValue(elContext);
if (! passwordValue.equals(passwordConfirmValue)) {
context.setError("Error creating user", "The password confirmation value does not match the password value");
return;
}
}
user.setPassword(passwordValue.toString());
}
if (emailExpression != null) {
final Object emailValue = emailExpression.getValue(elContext);
if (emailValue == null) {
context.setError("Error creating user", "The email value is null");
return;
}
user.setEmail(emailValue.toString());
}
identitySession.saveUser(user);
if (targetExpression != null) {
targetExpression.setValue(elContext, user);
}