12345678910111213141516171819202122232425262728293031323334353637 |
- app.controller('StdModifyPasswordCtrl', function($rootScope, $scope, $http, $timeout, $state, toaster) {
- $scope.load = function(){
- $scope.entity = {
- old_password: '',
- new_password: '',
- confirm_password: ''
- }
- }
- $scope.load();
- $scope.submitForm = function(isValid) {
- $scope.submitted = true;
- if($scope.entity.new_password != $scope.entity.confirm_password){
- $rootScope.dialogMsg("两次输入的新密码不一致");
- return;
- }
-
- if(isValid){
- $scope.myPromise = $http({
- url : $rootScope.host_url + '/user/password?session=' + $rootScope.session,
- method : 'POST',
- data: angular.toJson($scope.entity)
- }).success(function(data) {
- if(data.code == 0){
- $rootScope.dialogMsg('密码修改成功,请重新登录', function(){
- $rootScope.logout();
- })
- }else{
- toaster.pop('error', data.message);
- }
- }).error(function() {
- });
- }
-
- };
- });
|