Fix for EMM-1575

4.x.x
kamidu 8 years ago
parent 75df243a33
commit 0ab9db2afd

@ -103,12 +103,12 @@
<label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label>
</div>
{{#if canViewRoles}}
<label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user">
User Roles
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
{{#if canViewRoles}}
<div class="wr-input-control">
<select id="roles" class="form-control select2" multiple="multiple">
{{#each roles}}

@ -179,6 +179,7 @@ $("#userStore").change(
$("select option:selected").each(function () {
str += $(this).text() + "";
});
if ($("#roles").length > 0) {
var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + str + "&limit=100";
invokerUtil.get(
@ -200,6 +201,8 @@ $("#userStore").change(
}
);
}
}).change();
$(document).ready(function () {
@ -224,7 +227,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val();
var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val();
var roles = $("select#roles").val();
var roles ;
if ($("#roles").length > 0) {
roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span";
if (!username) {
@ -272,7 +278,9 @@ $(document).ready(function () {
$("input#firstname").val("");
$("input#lastname").val("");
$("input#email").val("");
if ($("#roles").length > 0) {
$("select#roles").select2("val", "");
}
// Refreshing with success message
$("#user-create-form").addClass("hidden");
$("#user-created-msg").removeClass("hidden");

@ -36,7 +36,7 @@
{{/zone}}
{{#zone "content"}}
{{#if canManage}}
{{#if canManage}}
<!-- content/body -->
<div class="row">
<div class="col-md-12">
@ -51,7 +51,8 @@
<div id="user-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label" title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY">
<label class="wr-input-label"
title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY">
User Store Domain
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
@ -94,8 +95,10 @@
<span class="glyphicon glyphicon-remove form-control-feedback hidden emailError"></span>
<label class=" hidden error email-required" for="summary">This field is
required.</label>
<label class=" hidden error email-invalid" for="summary">Invalid Email Address.</label>
<label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label>
</div>
{{#if canViewRoles}}
<label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user">
User Roles
@ -109,6 +112,7 @@
{{/each}}
</select>
</div>
{{/if}}
</div>
</div>
<br>
@ -137,14 +141,14 @@
</div>
</div>
<!-- /content/body -->
{{else}}
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You not authorized to enter User Management Section.
<br>
{{/if}}
{{/if}}
{{/zone}}

@ -63,6 +63,9 @@ function onRequest() {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/view")) {
page.canViewRoles = true;
}
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];

@ -75,7 +75,7 @@ var disableInlineError = function (inputField, errorMsg, errorSign) {
*/
validateInline["user-name"] = function () {
var usernameinput = $("input#username");
if (inputIsValid( usernameinput.data("regex"), usernameinput.val())) {
if (inputIsValid(usernameinput.data("regex"), usernameinput.val())) {
disableInlineError("usernameInputField", "usernameEmpty", "usernameError");
} else {
enableInlineError("usernameInputField", "usernameEmpty", "usernameError");
@ -113,12 +113,12 @@ validateInline["last-name"] = function () {
validateInline["emailAddress"] = function () {
var email = $("#emailAddress").val();
if (!email) {
enableInlineError("emailField", "email-required" , "emailError");
enableInlineError("emailField", "email-required", "emailError");
} else if (emailIsValid(email)) {
disableInlineError("emailField", "email-required" , "emailError");
disableInlineError("emailField", "email-invalid" , "emailError");
disableInlineError("emailField", "email-required", "emailError");
disableInlineError("emailField", "email-invalid", "emailError");
} else {
enableInlineError("emailField", "email-invalid" , "emailError");
enableInlineError("emailField", "email-invalid", "emailError");
}
};
@ -148,8 +148,8 @@ clearInline["last-name"] = function () {
* clear Validation messages when gain focus to the field.
*/
clearInline["emailAddress"] = function () {
disableInlineError("emailField", "email-required" , "emailError");
disableInlineError("emailField", "email-invalid" , "emailError");
disableInlineError("emailField", "email-required", "emailError");
disableInlineError("emailField", "email-invalid", "emailError");
};
/**
@ -168,11 +168,16 @@ $(document).ready(function () {
$("select.select2[multiple=multiple]").select2({
tags: false
});
var roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, "");
var roleList, roleArr;
if ($("#roles").length > 0) {
roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, "");
roleList = roleList.replace(/(\r\n|\n|\r)/gm, "");
var roleArr = roleList.split(",");
$("#roles").val(roleArr).trigger("change");
roleArr = roleList.split(",");
}
if ($("#roles").length > 0) {
$("#roles").val(roleArr).trigger("change");
}
/**
* Following click function would execute
* when a user clicks on "Add User" button
@ -188,7 +193,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val();
var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val();
var roles;
if ($("#roles").length > 0) {
var roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span";
if (!username) {
@ -255,27 +263,27 @@ $(document).ready(function () {
}
});
$("#emailAddress").focus(function() {
$("#emailAddress").focus(function () {
clearInline["emailAddress"]();
});
$("#emailAddress").blur(function() {
$("#emailAddress").blur(function () {
validateInline["emailAddress"]();
});
$("#lastname").focus(function() {
$("#lastname").focus(function () {
clearInline["last-name"]();
});
$("#lastname").blur(function() {
$("#lastname").blur(function () {
validateInline["last-name"]();
});
$("#firstname").focus(function() {
$("#firstname").focus(function () {
clearInline["first-name"]();
});
$("#firstname").blur(function() {
$("#firstname").blur(function () {
validateInline["first-name"]();
});
});
Loading…
Cancel
Save