Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TeamDbAwesome/TeamDBAwesome/TeamDBAwesome/js/userController.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
63 lines (57 sloc)
1.63 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The user controller will deal with | |
angular.module('routerApp').controller('userController', function($q,$window, $scope,$state, $stateParams, $location, $http, $cookies, urlService,$rootScope) { | |
/* Retrieve Url */ | |
var url = urlService.web; | |
$location.hash("top"); | |
$scope.COOKIE = $cookies.getAll(); | |
/* Begin Function Definitions */ | |
$scope.authenticateUser = function(id,pass){ | |
return $q(function(resolve,reject){ | |
var param = id + " " + pass; | |
var promise = $http.post(url + "/authenticateUser",param) | |
.success(function(data,status) { | |
console.log(data); | |
if (data.STATUS == 555) { | |
$scope.authenticated = false; | |
resolve('We did it'); | |
} else { | |
$scope.authenticated = true; | |
resolve('We did it'); | |
} | |
}) | |
.error(function(data, status, headers, config) { | |
$scope.messages = 'There was a network error. Try again later.'; | |
reject('We did not do it'); | |
}); | |
}) | |
} | |
$scope.logout = function(){ | |
$scope.messages = 'You have been logged out.'; | |
$cookies.remove("PWD"); | |
$cookies.remove("DEPID"); | |
$cookies.remove('LOGIN'); | |
$state.go('user'); | |
} | |
$scope.myData = [ | |
{ | |
"firstName": "Cox", | |
"lastName": "Carney", | |
"company": "Enormo", | |
"employed": true | |
}, | |
{ | |
"firstName": "Lorraine", | |
"lastName": "Wise", | |
"company": "Comveyer", | |
"employed": false | |
}, | |
{ | |
"firstName": "Nancy", | |
"lastName": "Waters", | |
"company": "Fuelton", | |
"employed": false | |
} | |
]; | |
/* End Function Definitions */ | |
/* Begin Logic */ | |
}); |