Repository: incubator-ignite Updated Branches: refs/heads/ignite-843 87be52723 -> d6894afff
# IGNITE-843 Implement password chanding Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/d6894aff Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/d6894aff Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/d6894aff Branch: refs/heads/ignite-843 Commit: d6894afffb083063577e6d75c3981094dcac1554 Parents: 87be527 Author: sevdokimov <sergey.evdoki...@jetbrains.com> Authored: Thu Jul 9 16:41:31 2015 +0300 Committer: sevdokimov <sergey.evdoki...@jetbrains.com> Committed: Thu Jul 9 16:41:31 2015 +0300 ---------------------------------------------------------------------- .../nodejs/controllers/profile-controller.js | 4 ++++ modules/web-control-center/nodejs/routes/profile.js | 12 +++++++----- modules/web-control-center/nodejs/views/login.jade | 2 +- 3 files changed, 12 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6894aff/modules/web-control-center/nodejs/controllers/profile-controller.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/controllers/profile-controller.js b/modules/web-control-center/nodejs/controllers/profile-controller.js index ff239a9..5610a18 100644 --- a/modules/web-control-center/nodejs/controllers/profile-controller.js +++ b/modules/web-control-center/nodejs/controllers/profile-controller.js @@ -47,6 +47,10 @@ controlCenterModule.controller('profileController', ['$scope', '$alert', '$http' $http.post('/profile/changePassword', {_id: $scope.editableUser._id, pass: $scope.pass1}).success(function() { $scope.showInfo('Password has been changed'); + + $scope.pass1 = ''; + $scope.pass2 = ''; + $scope.showChangePasswordForm = false; }).error(function(err) { $scope.showError('Failed to change password: ' + commonFunctions.errorMessage(err)); }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6894aff/modules/web-control-center/nodejs/routes/profile.js ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/routes/profile.js b/modules/web-control-center/nodejs/routes/profile.js index 11eb04b..1561704 100644 --- a/modules/web-control-center/nodejs/routes/profile.js +++ b/modules/web-control-center/nodejs/routes/profile.js @@ -65,14 +65,16 @@ router.post('/profile/changePassword', function(req, res) { if (err) return res.status(500).send(err); - user.salt = user.makeSalt(); - user.hash = user.encryptPassword(pass); - - user.save(function (err) { + user.setPassword(pass, function (err, updatedUser) { if (err) return res.status(500).send(err); - res.json(uiUtils.filterUser(val)); + updatedUser.save(function(err) { + if (err) + return res.status(500).send(err); + + res.json(uiUtils.filterUser(user)); + }); }); }) }); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/d6894aff/modules/web-control-center/nodejs/views/login.jade ---------------------------------------------------------------------- diff --git a/modules/web-control-center/nodejs/views/login.jade b/modules/web-control-center/nodejs/views/login.jade index 35cbad1..a15bd73 100644 --- a/modules/web-control-center/nodejs/views/login.jade +++ b/modules/web-control-center/nodejs/views/login.jade @@ -48,5 +48,5 @@ a.show-signup.ng-hide(ng-show='action != "login"', ng-click='action = "login";') log in a.show-signup(ng-show="action != 'register'", ng-click='action = "register";') sign up | or - button.btn.btn-primary(ng-show='action == "login"' ng-disabled='loginForm.$invalid' ng-click='auth(action, user_info)') Log In + button.btn.btn-primary(ng-show='action == "login"' ng-click='auth(action, user_info)') Log In button.btn.btn-primary(ng-show='action == "register"' ng-disabled='loginForm.$invalid || user_info.password != user_info.confirm' ng-click='auth(action, user_info)') Sign Up