Commit 9b112a598518479aee01ad14917fc76af9c4f1d4

Authored by Kuldeep Arora
1 parent 3b466beb3e
Exists in master

additional account reset pwd ui

app/partials/accountSetting/accountSetting.Controller.js
... ... @@ -167,7 +167,21 @@
167 167 $scope.cancelDelete = function(){
168 168 $('#delete1').css('display', 'none');
169 169 }
170   -
  170 +
  171 + $scope.resetPassword = function(email) {
  172 + console.log("emailid",email)
  173 + AccountSettingService.resetPassword(email).then(function(result){
  174 + if(typeof result == 'object') {
  175 + toastr.info("Password generated successfully. Please check your email for new password");
  176 + //localStorage.setItem('requiredChangePwd', "Y");
  177 + //$state.go('login');
  178 + } else {
  179 + toastr.info("Error in generating password");
  180 + }
  181 + })
  182 + }
  183 +
  184 +
171 185 }
172 186 })();
173 187  
... ...
app/partials/accountSetting/accountSetting.Service.js
... ... @@ -171,6 +171,23 @@
171 171 return deferred.promise;
172 172 }
173 173  
  174 + this.resetPassword = function(email) {
  175 + var param = 'email='+ email;
  176 + var deferred = $q.defer();
  177 + $http({
  178 + method : 'PUT',
  179 + url : BASE_URL.url +'/user/recoverpassword',
  180 + headers : {'Content-Type': 'application/x-www-form-urlencoded'},
  181 + data: param
  182 + })
  183 + .then(function (result){
  184 + deferred.resolve(result.data);
  185 + },function (result){
  186 + deferred.resolve(result.data);
  187 + })
  188 + return deferred.promise;
  189 + }
  190 +
174 191 }
175 192  
176 193 })();
177 194 \ No newline at end of file
... ...
app/partials/accountSetting/accountSetting.html
... ... @@ -84,8 +84,8 @@
84 84 <td>{{additionalAccount.lastName}}</td>
85 85 <td>{{additionalAccount.userName}}</td>
86 86 <!-- <td>{{additionalAccount.password}}</td> -->
87   - <td> <button type="button" class="btn btn-primary step step-1" data-step="1" ng-click="resetPassword()" >Reset Password</button></td>
88   - <td>
  87 + <td> <button type="button" class="btn btn-primary step step-1" data-step="1" ng-click="resetPassword(additionalAccount.userName)" >Reset Password</button></td>
  88 + <td>
89 89 <toggle ng-model="additionalAccount.status" ng-change="changeStatus(additionalAccount.id, $index)" size="customToogle"></toggle>
90 90 </td>
91 91 </tr>
... ...