Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.controller('LoginController', function ($rootScope, $scope, $cookieStore, $state, AuthenticationService, $timeout, $http, apiserv) {
- $scope.dataLoading = false;
- $scope.error = $rootScope.message;
- $rootScope.globals = [];
- $cookieStore.remove('globals');
- $cookieStore.remove('auth');
- $scope.login = function () {
- $scope.dataLoading = true;
- var url = apiserv + "api.login.php?username=" + $scope.username + "&password="+$scope.password;
- $http({url: url}).then(function (rs) {
- console.log(rs.data);
- if (rs.data.success) {
- var auth = rs.data.auth;
- $rootScope.globals = {
- currentUser: rs.data
- };
- $cookieStore.put('globals', $rootScope.globals);
- $cookieStore.put('auth', auth);
- debugger; // Where I took the above screenshot
- $state.go('app.sites');
- } else {
- $scope.error = rs.data.message;
- $scope.dataLoading = false;
- }
- });
- };
- }
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement