Browse Source

用户修改密码

git-svn-id: svn+ssh://10.10.101.21/source/platform/platform-b2b@758 f3bf4e98-0cf0-11e4-a00c-a99a8b9d557d
suntg 11 years ago
parent
commit
ab379cba30
1 changed files with 22 additions and 5 deletions
  1. 22 5
      src/main/webapp/resources/js/index/app.js

+ 22 - 5
src/main/webapp/resources/js/index/app.js

@@ -1906,11 +1906,13 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 			
 			modalInstance.result.then(function(){
-				$scope.tableParams.reload();
 			}, function(){
-				
 			});
 		};
+		
+		$scope.addUser = function(newUser) {
+			$scope.adding = true;
+		};
 	});
 	
 	app.controller('PasswordCtrl', function($scope, $modalInstance, user, AccountUser, toaster){
@@ -1921,7 +1923,6 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			$scope.checking = true;
 			$scope.checkSuccess = false;
 			$scope.checkFailed = false;
-			console.log(password);
 			AccountUser.checkPassword({password: password}, function(data){
 				$scope.checkSuccess = true;
 				$scope.checking = false;
@@ -1933,9 +1934,25 @@ define([ 'toaster', 'charts', 'ngTable', 'common/services', 'service/Purc', 'ser
 			});
 		};
 		
-		//确认送样
+		//修改密码
 		$scope.ok = function () {
-			
+			console.log($scope.user.newPassword);
+			console.log($scope.user.newPassword1);
+			if($scope.user.newPassword == $scope.user.newPassword1) {//验证重复密码相等
+				AccountUser.updatePassword({password: $scope.user.password, newPassword: $scope.user.newPassword}, {}, function(data){
+					toaster.pop('success', '成功', '修改密码成功,请牢记您的新密码。');
+					$scope.user.password = null;
+					$scope.user.newPassword = null;
+					$scope.user.newPassword1 = null;
+					$scope.checking = false;
+					$scope.checkSuccess = false;
+					$scope.checkFailed = false;
+				}, function(response){
+					toaster.pop('error', '错误', response.data);
+				});
+			} else {
+				toaster.pop('error', '错误', '重复密码不一致');
+			}
   		};
 
   		$scope.cancel = function () {