Merge pull request #945 from pasindujw/master

Fixes validation errors in user create and group create.
revert-70aa11f8
sinthuja 7 years ago committed by GitHub
commit 430a1e6a03

@ -110,7 +110,7 @@ public class GroupManagementServiceImpl implements GroupManagementService {
log.error(msg, e); log.error(msg, e);
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build(); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(msg).build();
} catch (GroupAlreadyExistException e) { } catch (GroupAlreadyExistException e) {
String msg = "Group already exists with name '" + group.getName() + "'."; String msg = "Group already exists with name " + group.getName() + ".";
log.warn(msg); log.warn(msg);
return Response.status(Response.Status.CONFLICT).entity(msg).build(); return Response.status(Response.Status.CONFLICT).entity(msg).build();
} }

@ -46,7 +46,7 @@
}, },
"groupValidationConfig": { "groupValidationConfig": {
"groupNameJSRegEx": "^[\\S]{3,30}$", "groupNameJSRegEx": "^[\\S]{3,30}$",
"groupNameRegExViolationErrorMsg": "Provided group name is invalid.", "groupNameRegExViolationErrorMsg": "Group name should be in minimum 3 characters long and should not include any whitespaces.",
"groupNameHelpMsg": "Should be in minimum 3 characters long and should not include any whitespaces." "groupNameHelpMsg": "Should be in minimum 3 characters long and should not include any whitespaces."
}, },
"roleValidationConfig": { "roleValidationConfig": {

@ -256,6 +256,9 @@ $(document).ready(function () {
} else if (!emailIsValid(emailAddress)) { } else if (!emailIsValid(emailAddress)) {
$(errorMsg).text("Provided email is invalid."); $(errorMsg).text("Provided email is invalid.");
$(errorMsgWrapper).removeClass("hidden"); $(errorMsgWrapper).removeClass("hidden");
} else if (!roles) {
$(errorMsg).text("Role is a required field. It cannot be empty.");
$(errorMsgWrapper).removeClass("hidden");
} else { } else {
var addUserFormData = {}; var addUserFormData = {};

@ -42,7 +42,5 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) { if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
page.canView = true; page.canView = true;
} }
return page; return page;
} }
Loading…
Cancel
Save