Skip to content
Permalink
0f924d8336
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
63 lines (57 sloc) 1.63 KB
// 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 */
});