Advertisement
Guest User

Untitled

a guest
May 16th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. if (response.user.state == 'active') {
  2. $scope.isNewUser = 0;
  3. console.log('response.user.email ');
  4. console.log(response.user.email);
  5. $state.go('login.login' , {'prefillEmail': response.user.email});
  6. //
  7. }
  8.  
  9. .state('login.login', {
  10. url: '/login',
  11. params: { redirect: { value: '' } },
  12. templateUrl: 'views/login.html',
  13. controller: 'loginCtrl',
  14. resolve: {
  15. redirect: function($stateParams) {
  16. return $stateParams.redirect;
  17. }
  18. }
  19. })
  20.  
  21. (function () {
  22. 'use strict';
  23.  
  24. angular.module('app')
  25. .controller('loginCtrl', function($scope, authService, redirect, $state, $location, $stateParams) {
  26.  
  27. $scope.credentials = {
  28. email: '',
  29. password: ''
  30. };
  31.  
  32. console.log('$stateParams');
  33. console.log($stateParams);
  34.  
  35. console.log('$state');
  36. console.log($state);
  37.  
  38.  
  39.  
  40. $scope.authenticate = function() {
  41.  
  42. authService.login($scope.credentials)
  43. .then(function(response) {
  44.  
  45. //Redirecting to hostname. Route check user type and return needed URL
  46. $location.path(redirect || '/');
  47. });
  48. }
  49. });
  50. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement