Commit f3850767 authored by Gabriel Guardincerri's avatar Gabriel Guardincerri Committed by gguardin

[JM-1410] Inconsistent error messages in new user creation from OF Admin...

[JM-1410] Inconsistent error messages in new user creation from OF Admin Console when CS is connected. To be reviewed.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@10638 b35dd754-fafc-0310-a699-88a17e54d16e
parent 36f61d00
......@@ -64,8 +64,7 @@
// Trim the password. This means we don't accept spaces as passwords. We don't
// trim the passwordConfirm as well since not trimming will ensure the user doesn't
// think space is an ok password character.
password = password.trim();
if (password == null || password.equals("")) {
if (password == null || password.trim().equals("")) {
errors.put("password","");
}
if (passwordConfirm == null) {
......@@ -76,7 +75,7 @@
}
// If provider requires email, validate
if (UserManager.getUserProvider().isEmailRequired()) {
if (StringUtils.isValidEmailAddress(email)) {
if (!StringUtils.isValidEmailAddress(email)) {
errors.put("email","");
}
}
......
......@@ -47,7 +47,7 @@
if (save) {
// If provider requires email, validate
if (UserManager.getUserProvider().isEmailRequired()) {
if (StringUtils.isValidEmailAddress(email)) {
if (!StringUtils.isValidEmailAddress(email)) {
errors.put("email","");
}
}
......@@ -58,27 +58,29 @@
}
}
user.setEmail(email);
user.setName(name);
if (!AdminManager.getAdminProvider().isReadOnly()) {
boolean isCurrentAdmin = AdminManager.getInstance().isUserAdmin(user.getUsername(), false);
if (isCurrentAdmin && !isAdmin) {
AdminManager.getInstance().removeAdminAccount(user.getUsername());
if (errors.size() == 0) {
user.setEmail(email);
user.setName(name);
if (!AdminManager.getAdminProvider().isReadOnly()) {
boolean isCurrentAdmin = AdminManager.getInstance().isUserAdmin(user.getUsername(), false);
if (isCurrentAdmin && !isAdmin) {
AdminManager.getInstance().removeAdminAccount(user.getUsername());
}
else if (!isCurrentAdmin && isAdmin) {
AdminManager.getInstance().addAdminAccount(user.getUsername());
}
}
else if (!isCurrentAdmin && isAdmin) {
AdminManager.getInstance().addAdminAccount(user.getUsername());
if (!SecurityAuditManager.getSecurityAuditProvider().blockUserEvents()) {
// Log the event
webManager.logEvent("edited user "+username, "set name = "+name+", email = "+email+", admin = "+isAdmin);
}
}
if (!SecurityAuditManager.getSecurityAuditProvider().blockUserEvents()) {
// Log the event
webManager.logEvent("edited user "+username, "set name = "+name+", email = "+email+", admin = "+isAdmin);
// Changes good, so redirect
response.sendRedirect("user-properties.jsp?editsuccess=true&username=" + URLEncoder.encode(username, "UTF-8"));
return;
}
// Changes good, so redirect
response.sendRedirect("user-properties.jsp?editsuccess=true&username=" + URLEncoder.encode(username, "UTF-8"));
return;
}
%>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment