UNPKG

unserver-unify

Version:

48 lines (47 loc) 1.42 kB
'use strict'; angular.module('bamboo').controller('ResetPwdCtrl', function($scope, ApiService, CommonService, AppConfig, $timeout) { var mschools; var self = this; this.config = AppConfig; //$scope.submitted = false; //console.log(this.config); this.data = { key: ApiService.queryData.key, name: ApiService.queryData.name, }; ApiService.queryData={}; //used console.log(this.data); $scope.resetPwd = function() { $scope.submitted = true; if ($scope.form.$invalid) { $scope.shaking = true; $timeout(function() { $scope.shaking = false; }, 500); return; } // if (self.data.psw != self.data.repsw) { // $scope.error = "Passwords are not matched"; // $scope.success = null; // return; // } // if (self.data.psw.length < 5) { // $scope.error = "Password are too short"; // $scope.success = null; // return; // } console.log(self.data); ApiService.post('/reset_pass', self.data).then(function(result) { console.log(result); if (result.data.success) { $scope.error = ""; $scope.success = result.data.info; CommonService.showInfo('Reset Password Successful!'); } else { CommonService.showError('Something wrong, please check your url!'); $scope.error = result.error; } }); }; });