|
|
@@ -415,6 +415,21 @@ define(['app/app'], function(app) {
|
|
|
}, function(){
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+ $scope.updateUserEmail = function(){
|
|
|
+ var modalInstance = $modal.open({
|
|
|
+ animation: true,
|
|
|
+ templateUrl: $rootScope.rootPath + '/static/view/vendor/modal/updateUserEmail.html',
|
|
|
+ controller: 'UserEmailCtrl',
|
|
|
+ resolve: {
|
|
|
+ user: function(){return angular.copy($rootScope.userInfo);}
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ modalInstance.result.then(function(){
|
|
|
+ }, function(){
|
|
|
+ });
|
|
|
+ };
|
|
|
}]);
|
|
|
|
|
|
// 修改密码Controller
|
|
|
@@ -466,4 +481,90 @@ define(['app/app'], function(app) {
|
|
|
$modalInstance.close();
|
|
|
};
|
|
|
}]);
|
|
|
+
|
|
|
+ // 修改密码Controller
|
|
|
+ app.register.controller('UserEmailCtrl', ['$scope', '$modalInstance', 'user', 'User', 'toaster', function($scope, $modalInstance, user, User, toaster){
|
|
|
+ $scope.user = user;
|
|
|
+ $scope.checking = false;
|
|
|
+ //验证用户输入的邮箱地址是否正确
|
|
|
+ $scope.checkUserEmail = function(userEmail) {
|
|
|
+ $scope.checking = true;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ User.checkUserEmail({userEmail: userEmail}, function(){
|
|
|
+ $scope.checkSuccess = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ }, function(){
|
|
|
+ $scope.checkFailed = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //验证邮箱是否可用
|
|
|
+ $scope.checkUserEmail = function(userEmail) {
|
|
|
+ $scope.checking = true;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ User.checkUserEmail({userEmail: userEmail}, function(){
|
|
|
+ $scope.checkSuccess = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ }, function(){
|
|
|
+ $scope.checkFailed = true;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.emailEnable = function(newUserEmail) {
|
|
|
+ $scope.emailSuccess = false;
|
|
|
+ $scope.emailFailed = false;
|
|
|
+ User.checkUserEmail({userEmail: newUserEmail}, function(){
|
|
|
+ $scope.emailSuccess = true;
|
|
|
+ $scope.emailFailed = false;
|
|
|
+ }, function(){
|
|
|
+ $scope.emailFailed = true;
|
|
|
+ $scope.emailSuccess = false;
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.sendCheckCode = function(newUserEmail) {
|
|
|
+ User.sendCheckCode({newUserEmail: newUserEmail}, function(){
|
|
|
+
|
|
|
+ }, function(){
|
|
|
+
|
|
|
+ });
|
|
|
+ };
|
|
|
+
|
|
|
+ //修改密码
|
|
|
+ $scope.ok = function () {
|
|
|
+ if($scope.user.newPassword == $scope.user.password){
|
|
|
+ toaster.pop('error', '错误', '新密码与原密码相同');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if($scope.user.newPassword == $scope.user.newPassword1) {//验证重复密码相等
|
|
|
+ User.updatePassword({password: $scope.user.password, newPassword: $scope.user.newPassword}, {}, function(){
|
|
|
+ toaster.pop('success', '成功', '修改密码成功,请牢记您的新密码。');
|
|
|
+ $scope.user.password = null;
|
|
|
+ $scope.user.newPassword = null;
|
|
|
+ $scope.user.newPassword1 = null;
|
|
|
+ $scope.checking = false;
|
|
|
+ $scope.checkSuccess = false;
|
|
|
+ $scope.checkFailed = false;
|
|
|
+ $modalInstance.close();
|
|
|
+ }, function(response){
|
|
|
+ toaster.pop('error', '错误', response.data);
|
|
|
+ $modalInstance.close();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ toaster.pop('error', '错误', '重复密码不一致');
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ $scope.cancel = function () {
|
|
|
+ $modalInstance.close();
|
|
|
+ };
|
|
|
+ }]);
|
|
|
});
|