updatePsdCtrl.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. angular.module('push')
  2. .controller('updatePsdCtrl', function ($scope, LoginService, UtilService, UserService, ConfigService, $ionicHistory, $timeout, SqliteStorageService, $ionicPopup, CommonService, $state) {
  3. $scope.password = {
  4. phone: UserService.user.mobile,
  5. userPassword: UserService.user.password,
  6. oldpassword: '',
  7. password1: '',
  8. password2: ''
  9. };
  10. $scope.defaultLan = UserService.defaultLan;
  11. $scope.updatePsd = function (password) {
  12. LoginService.updatePsd(password).then(function (response) {
  13. if (response.code == 3350) {
  14. if (response.message == "输入的原密码与用户密码不一致") {
  15. $ionicPopup.alert({
  16. title: '提示',
  17. template: '您输入的旧密码不正确'
  18. })
  19. return;
  20. }
  21. sessionStorage.password = response.data.password;
  22. UserService.user.password = response.data.password;
  23. $ionicPopup.alert({
  24. title: '提示',
  25. template: '修改成功!'
  26. })
  27. $scope.go('tab.account');
  28. } else {
  29. $ionicPopup.alert({
  30. title: '提示',
  31. template: '修改失败'
  32. })
  33. return;
  34. }
  35. }, function () {
  36. $scope.hideLoadingToast();
  37. });
  38. }
  39. $scope.show_psd=false;
  40. $scope.show_psd1=false;
  41. $scope.show_psd2=false;
  42. $scope.showPassword = function () {
  43. $scope.show_psd = !$scope.show_psd;
  44. //$scope.show_psd = false;
  45. };
  46. $scope.showPassword1 = function () {
  47. $scope.show_psd1 = !$scope.show_psd1;
  48. //$scope.show_psd = false;
  49. };
  50. $scope.showPassword2 = function () {
  51. $scope.show_psd2 = !$scope.show_psd2;
  52. //$scope.show_psd = false;
  53. };
  54. });