Sha256: 93271fd9642c3dfb8ab4f7ff8a27f7ba7cac2f4e71cbf2b43181812694c0db24

Contents?: true

Size: 1.47 KB

Versions: 19

Compression:

Stored size: 1.47 KB

Contents

import { Controller } from 'a1atscript';

@Controller('PasswordsRequestCtrl', ['$scope', '$auth', '$state', '$xngToast', 'Serializer'])
export function PasswordsRequestController( $scope, $auth, $state, $xngToast, 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) {
        $xngToast.errorList(resp.data.errors);
        // handle error response
      });
  };
}

@Controller('PasswordsUpdateCtrl', ['$scope', '$auth', '$state', '$xngToast', '$location', 'Serializer'])
export function PasswordsUpdateController( $scope, $auth, $state, $xngToast, $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) {
        $xngToast.errorList(resp.data.errors, "We could not update your password because:");
        // handle error response
      });
  };
}

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
xing-framework-1.0.0.pre.beta.1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-1.0.0.pre.beta default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-1.0.0.pre.alpha default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.3.2 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.3.1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.3.0 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.9 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.9.beta1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.8 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.8.beta1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.7 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.7.pre.beta1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.6 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.5 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.4 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.3 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.2 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.1 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js
xing-framework-0.2.0 default_configuration/base_app/frontend/src/app/auth/passwords/passwordsControllers.js