Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function login (event) {
- event.preventDefault();
- Auth.login({
- username: vm.username,
- password: vm.password,
- rememberMe: vm.rememberMe
- }).then(function () {
- vm.authenticationError = false;
- $uibModalInstance.close();
- if ($state.current.name === 'register' || $state.current.name === 'activate' ||
- $state.current.name === 'finishReset' || $state.current.name === 'requestReset') {
- $state.go('home');
- }
- $rootScope.$broadcast('authenticationSuccess');
- // previousState was set in the authExpiredInterceptor before being redirected to login modal.
- // since login is succesful, go to stored previousState and clear previousState
- if (Auth.getPreviousState()) {
- var previousState = Auth.getPreviousState();
- Auth.resetPreviousState();
- $state.go(previousState.name, previousState.params);
- }
- }).catch(function () {
- vm.authenticationError = true;
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement