diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java index ce403fa2813..356aa7afef0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/UserManagementService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.device.mgt.jaxrs.service.api; import io.swagger.annotations.*; import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.Permission; -import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.device.mgt.jaxrs.beans.*; import javax.ws.rs.*; @@ -471,7 +470,7 @@ public interface UserManagementService { "Server error occurred while updating credentials of the user.", response = ErrorResponse.class) }) - @Permission(name = "View Users", permission = "/device-mgt/users/view") + @Permission(name = "Reset user password", permission = "/login") Response resetPassword( @ApiParam( name = "username", diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/public/js/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/public/js/user-menu.js index 34bb5c1ddd0..a622f40543c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/public/js/user-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/public/js/user-menu.js @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + /** * Checks if provided input is valid against RegEx input. * @@ -21,34 +39,33 @@ $(document).ready(function () { showPopup(); $("a#change-password-yes-link").click(function () { - var oldPassword = $("#old-password").val(); + var currentPassword = $("#current-password").val(); var newPassword = $("#new-password").val(); - var confirmedPassword = $("#confirmed-password").val(); + var retypedNewPassword = $("#retyped-new-password").val(); var user = $("#user").val(); - var errorMsgWrapper = "#notification-error-msg"; - var errorMsg = "#notification-error-msg span"; - if (!oldPassword) { - $(errorMsg).text("Old password is a required field. It cannot be empty."); + var errorMsgWrapper = "#change-password-error-msg"; + var errorMsg = "#change-password-error-msg span"; + if (!currentPassword) { + $(errorMsg).text("Typing your current password is required. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); } else if (!newPassword) { - $(errorMsg).text("New password is a required field. It cannot be empty."); + $(errorMsg).text("Typing your new password is required. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); - } else if (!confirmedPassword) { - $(errorMsg).text("Retyping the new password is required."); + } else if (!retypedNewPassword) { + $(errorMsg).text("Confirming your new password is required. It cannot be empty."); $(errorMsgWrapper).removeClass("hidden"); - } else if (confirmedPassword != newPassword) { - $(errorMsg).text("New password doesn't match the confirmation."); + } else if (retypedNewPassword != newPassword) { + $(errorMsg).text("Password confirmation failed. Please check."); $(errorMsgWrapper).removeClass("hidden"); - } else if (!inputIsValid(/^[\S]{5,30}$/, confirmedPassword)) { - $(errorMsg).text("Password should be minimum 5 characters long, should not include any whitespaces."); + } else if (!inputIsValid(/^[\S]{5,30}$/, newPassword)) { + $(errorMsg).text("Password should be minimum 5 characters long and " + + "should not include any whitespaces. Please check."); $(errorMsgWrapper).removeClass("hidden"); } else { var changePasswordFormData = {}; - //changePasswordFormData.username = user; - changePasswordFormData.newPassword = unescape((confirmedPassword)); - changePasswordFormData.oldPassword = unescape((oldPassword)); - + changePasswordFormData["oldPassword"] = unescape((currentPassword)); + changePasswordFormData["newPassword"] = unescape((newPassword)); var changePasswordAPI = "/api/device-mgt/v1.0/users/" + user + "/credentials"; @@ -64,7 +81,7 @@ $(document).ready(function () { } }, function (jqXHR) { if (jqXHR.status == 400) { - $(errorMsg).text("Old password does not match with the provided value."); + $(errorMsg).text("Your current password does not match with the provided value."); $(errorMsgWrapper).removeClass("hidden"); } else { $(errorMsg).text("An unexpected error occurred. Please try again later."); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.hbs index c4fd938ae5e..1ff652c8c87 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.hbs @@ -15,73 +15,91 @@ specific language governing permissions and limitations under the License. }} + {{#zone "userMenu-items"}}
  • Change password
  • + Sign out
  • +
    -
    -
    -
    -

    Password change is successful.

    -
    - Ok -
    -
    + +
    + +
    {{/zone}} {{#zone "bottomJs"}} - + {{js "/js/user-menu.js"}} {{/zone}} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js index e0ebe26b0a4..39819deacf7 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js @@ -1,3 +1,21 @@ +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * WSO2 Inc. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, + * either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + function onRequest() { var constants = require("/app/modules/constants.js"); return session.get(constants["USER_SESSION_KEY"]); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs index 2c36f248d4a..34b21301edd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/nav-menu.hbs @@ -105,7 +105,7 @@ data-offset-top="80"> - +
    {{/zone}} {{#zone "bottomJs"}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/jquery.qrcode.min.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/jquery.qrcode.min.js old mode 100755 new mode 100644 diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js index 5f3605da38a..e94a5500a65 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.navbar.nav-menu/public/js/nav-menu.js @@ -102,23 +102,28 @@ function loadNewNotifications() { if (responsePayload.count > 0) { $(messageSideBar).html(template(viewModel)); } else { - $(messageSideBar).html("

    No new notifications found...

    "); + $(messageSideBar).html( + "

    No New Notifications

    " + + "
    " + + "Check this section for error notifications
    related to device operations" + + "
    " + ); } } else { - $(messageSideBar).html("

    Unexpected error occurred while loading new notifications.

    "); + $(messageSideBar).html("

    Unexpected error occurred while loading new notifications

    "); } } }; var errorCallback = function (jqXHR) { if (jqXHR.status = 500) { - $(messageSideBar).html("

    Unexpected error occurred while trying " + - "to retrieve any new notifications.

    "); + $(messageSideBar).html("

    Unexpected error occurred while trying " + + "to retrieve any new notifications

    "); } }; invokerUtil.get(serviceURL, successCallback, errorCallback); }); } else { - $(messageSideBar).html("

    You are not authorized to view notifications

    "); + $(messageSideBar).html("

    You are not authorized to view notifications

    "); } }