Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "use strict";
- angular.module("LoginPage")
- .controller("LoginPageController", ["$scope", "$rootScope", "OAuth", "$http", 'URLS', "$location",
- function ($scope, $rootScope, OAuth, $http, URLS, $location) {
- // $scope.urls = URLS;
- $scope.loginData = {
- username: null,
- password: null
- };
- $scope.login = function ($event, form) {
- if (form) {
- if (!form.$invalid) {
- OAuth.getAccessToken({
- username: $scope.loginData.username,
- password: $scope.loginData.password
- }).then(function (response) {
- console.log(response.data.user_id);
- $location.path(URLS.COMMUNITY);
- });
- }
- } else {
- throw '$scope.login : form is missing'
- }
- // $http({
- // method: 'POST',
- // url: 'http://api.thinktoscore.com/auth/token',
- // headers: {
- // 'Content-Type': 'application/x-www-form-urlencoded'
- // },
- // data: 'grant_type=password&username=' + $scope.loginData.username + '&password=' + $scope.loginData.password + '&client_id=web_app'
- //
- // }).success(function (data) {
- // $location.path(URLS.COMMUNITY);
- //
- // });
- };
- if (OAuth.isAuthenticated()) {
- $location.path(URLS.COMMUNITY);
- }
- }
- ])
- .service("loginService", ["$rootScope",
- function ($rootScope, $http) {
- $http({
- method: 'GET',
- url: '/someUrl'
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- }, function errorCallback(response) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- });
- }]);
- var test = {
- "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",
- "token_type": "bearer",
- "expires_in": 2591999,
- "refresh_token": "8227a1a0faf540a393a9ed1a7c815cda",
- "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier": "U_TEAMKUKILAGET",
- "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name": "teamkukilaget",
- "http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider": "ASP.NET Identity",
- "AspNet.Identity.SecurityStamp": "a641fbdd-2e60-44e6-9269-f0b17f7466ee",
- "http://schemas.microsoft.com/ws/2008/06/identity/claims/role": "Admin,Blueprint Tester,Customization Tester,Debugger,DoNotTrack",
- "user_id": "a8bd8aa0-ec2e-4b86-9f04-8b278dc49442",
- "client_id": "native_app",
- "roles": "Admin,Blueprint Tester,Customization Tester,Debugger,DoNotTrack",
- ".issued": "Sun, 29 May 2016 17:00:27 GMT",
- "issued": "Sun, 29 May 2016 17:00:27 GMT",
- ".expires": "Tue, 28 Jun 2016 17:00:27 GMT", "expires": "Tue, 28 Jun 2016 17:00:27 GMT"
- }
Add Comment
Please, Sign In to add comment