Guest User

Untitled

a guest
May 31st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. "use strict";
  2. angular.module("LoginPage")
  3. .controller("LoginPageController", ["$scope", "$rootScope", "OAuth", "$http", 'URLS', "$location",
  4. function ($scope, $rootScope, OAuth, $http, URLS, $location) {
  5.  
  6. // $scope.urls = URLS;
  7. $scope.loginData = {
  8. username: null,
  9. password: null
  10. };
  11. $scope.login = function ($event, form) {
  12. if (form) {
  13. if (!form.$invalid) {
  14. OAuth.getAccessToken({
  15. username: $scope.loginData.username,
  16. password: $scope.loginData.password
  17. }).then(function (response) {
  18. console.log(response.data.user_id);
  19. $location.path(URLS.COMMUNITY);
  20.  
  21. });
  22. }
  23. } else {
  24. throw '$scope.login : form is missing'
  25. }
  26. // $http({
  27. // method: 'POST',
  28. // url: 'http://api.thinktoscore.com/auth/token',
  29. // headers: {
  30. // 'Content-Type': 'application/x-www-form-urlencoded'
  31. // },
  32. // data: 'grant_type=password&username=' + $scope.loginData.username + '&password=' + $scope.loginData.password + '&client_id=web_app'
  33. //
  34. // }).success(function (data) {
  35. // $location.path(URLS.COMMUNITY);
  36. //
  37. // });
  38.  
  39. };
  40.  
  41. if (OAuth.isAuthenticated()) {
  42. $location.path(URLS.COMMUNITY);
  43. }
  44.  
  45. }
  46. ])
  47. .service("loginService", ["$rootScope",
  48. function ($rootScope, $http) {
  49. $http({
  50. method: 'GET',
  51. url: '/someUrl'
  52. }).then(function successCallback(response) {
  53. // this callback will be called asynchronously
  54. // when the response is available
  55. }, function errorCallback(response) {
  56. // called asynchronously if an error occurs
  57. // or server returns response with an error status.
  58. });
  59.  
  60. }]);
  61.  
  62.  
  63. var test = {
  64. "access_token": "j6jMdTMiivpnzldS77l__7HbR08WbBwMQiixk0boiuGbtMnvYKDUtCrdw5mtpf8sckz-XhPgEvAkTi6CfFy15-7IUCqgT-vHciX7U_nxoCrfkh0LtWAn9PJw2SEawsdGOoCsU1NJyrwPT-P-j1JvwD48BUdxwIxRYNNAsxBygf3mZEsWptFHFfMu4mYO1O-YB7wtF_XfJY3bPwaNM3DH4D2uiHZIucy7c-LYFRatwnliylM9EGjij8Kh1z3vR7hw1x50S4JUEF88LBMSHfN4P3ouIA0MPvQYitnJtPQSq2Xiu3f_K_f_F2rnbBRWveC5GL4b-mFyNMwayCgPfb6wISC9nWcQwaEoHZvJFHWLb9Xz67zrHxj8zm1JVv3y4RKqk3QJWuIiG2tzbruTiOP-KTfOOCFmv0xsdyK0J8efRnn5mXvFoMDv6ii2k3-l71hPZt56NqouEZNq-yNzvvnmqB2lhR0SusNcKui5nE-GK8S8oa_l3Qq3b4knaJdSiQBqcJvSVMSMiX5l_JPKwwBZIpNMU6VYD4d3wnXTRStm5fOM5TzArLEbEdL_si_eSPRZnhCOHB_Eg5jZ43N9wWcqaJ9mL_m1tnJNrp2-GOX2tn4xY_o9pVW2Pv70n4Y_qtSKrKH1ziaAIkoK_6k6aNBqoEd7EfXYdrNMS8IK2H5RsLeiX-_O3PpdPrZijYz9_At99YsV7Q",
  65. "token_type": "bearer",
  66. "expires_in": 2591999,
  67. "refresh_token": "8227a1a0faf540a393a9ed1a7c815cda",
  68. "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "U_TEAMKUKILAGET",
  69. "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "teamkukilaget",
  70. "http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider": "ASP.NET Identity",
  71. "AspNet.Identity.SecurityStamp": "a641fbdd-2e60-44e6-9269-f0b17f7466ee",
  72. "http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "Admin,Blueprint Tester,Customization Tester,Debugger,DoNotTrack",
  73. "user_id": "a8bd8aa0-ec2e-4b86-9f04-8b278dc49442",
  74. "client_id": "native_app",
  75. "roles": "Admin,Blueprint Tester,Customization Tester,Debugger,DoNotTrack",
  76. ".issued": "Sun, 29 May 2016 17:00:27 GMT",
  77. "issued": "Sun, 29 May 2016 17:00:27 GMT",
  78. ".expires": "Tue, 28 Jun 2016 17:00:27 GMT", "expires": "Tue, 28 Jun 2016 17:00:27 GMT"
  79. }
Add Comment
Please, Sign In to add comment