Sha256: c18f242ff782d7b6d10be68c84a8d9565d1e800975f483ceb3a0d2933dedbdff

Contents?: true

Size: 1.47 KB

Versions: 2

Compression:

Stored size: 1.47 KB

Contents

import { Controller } from 'a1atscript';

@Controller('PasswordsRequestCtrl', ['$scope', '$auth', '$state', '$lrdToast', 'Serializer'])
export function PasswordsRequestController( $scope, $auth, $state, $lrdToast, Serializer) {
  $scope.passwordRequest = {
    email: '',
  };

  $scope.passwordRequestSubmit = function() {
    var serializer = new Serializer();

    $auth.requestPasswordReset(serializer.serialize({
      user: $scope.passwordRequest,
      update_url: $state.href("^.passwordsUpdate")
    }))
      .then(function(resp) {
        $state.go('root.inner.passwordsRequestSuccess');
      })
      .catch(function(resp) {
        $lrdToast.errorList(resp.data.errors);
        // handle error response
      });
  };
}

@Controller('PasswordsUpdateCtrl', ['$scope', '$auth', '$state', '$lrdToast', '$location', 'Serializer'])
export function PasswordsUpdateController( $scope, $auth, $state, $lrdToast, $location, Serializer) {
  $scope.passwordUpdate = {
    password: '',
    passwordConfirmation: ''
  };

  $scope.passwordUpdateSubmit = function() {
    var serializer = new Serializer();
    var query = $location.search();
    query["user"] = $scope.passwordUpdate;

    $auth.updatePassword(serializer.serialize(query))
      .then(function(resp) {
        $state.go('root.inner.passwordsUpdateSuccess');
      })
      .catch(function(resp) {
        $lrdToast.errorList(resp.data.errors, "We could not update your password because:");
        // handle error response
      });
  };
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xing-framework-0.0.3 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.0.2 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js