I got assigned to fix a problem left by another developer who just changed jobs, and I'm not having very much luck with it.
The application is a time entry site that allows users to log in with their existing Windows credentials to manage their time. I can pass their username and password in JSON via Postman to the login page and it will authenticate, however, when the same credentials are entered into the form via browser, it fails.
I've posted some screenshots and code behind the login page below. If there's anything else you need to see, just let me know.
http://delorean.cisng888.csa/
Album hosted on sli.mg[
^]
(function() {
angular.module('Thunderdome').controller('LoginController', function($http, $scope, $rootScope, $location, $cookieStore, $state, loggedInUser, Logout, RetrieveSystemStatus) {
RetrieveSystemStatus.retrieveStatus()
.then(function(data){
if(data[1].Value == "0")
{
$rootScope.systemStatus = data[1].Value;
$rootScope.systemMessage = "";
executeController()
}
else if(data[1].Value == "-1")
{
$rootScope.systemMessage = data[0].Value;
$scope.message = $rootScope.systemMessage;
$rootScope.systemStatus = data[1].Value;
}
else
{
$rootScope.systemMessage = data[0].Value;
$scope.message = $rootScope.systemMessage;
$rootScope.systemStatus = data[1].Value;
executeController();
}
},
function(error){
});
function executeController()
{
$scope.message = ($rootScope.systemMessage == "" ? "Welcome to Time Entry." : $rootScope.systemMessage);
$scope.username = "";
$scope.password = "";
$scope.returnedData = {};
$scope.userAlreadyLoggedIn = false;
$scope.showModal = false;
if(!loggedInUser.getProfile().init)
{
if(!loggedInUser.getProfile().errors.length)
{
$state.go('home.main');
}
else
{
$scope.message = loggedInUser.getProfile().errors[0].message;
}
}
$scope.login = function()
{
var data = {
"userName": $scope.username,
"password": $scope.password,
"browserString": navigator.appName
}
$http({
method: 'post',
url: 'http://10.1.150.174:8002/TimeEntry.svc/Login',
headers: {'Content-Type':'application/json; charset=UTF-8; charset-uf8'},
data: data
})
.success(function(data, status, headers, config) {
$scope.returnedData = data;
evaluateSuccessfulRetrieval();
})
.error(function(data, status, headers, config) {
$scope.message = "Oops, there has been issue.";
});
}
function evaluateSuccessfulRetrieval()
{
if($scope.returnedData.errors.length > 0)
handleReturnedError($scope.returnedData.errors);
else
{
$cookieStore.put("FunStuff", $scope.returnedData.auth);
loggedInUser.setProfile($scope.returnedData);
$state.go('home.main');
}
}
function handleReturnedError(errors)
{
if(errors[0].code != 2)
$scope.message = errors[0].message;
else
handleUserAlreadyLoggedIn();
}
function handleUserAlreadyLoggedIn()
{
$scope.userAlreadyLoggedIn = true;
$scope.showModal = true;
}
$scope.logout = function(code)
{
$scope.showModal = false;
if(code == '2')
logOutOtherLocation();
else
$scope.userAlreadyLoggedIn = false;
}
function logOutOtherLocation()
{
var logoutdata = {
"Auth": "",
"EmployeeID": $scope.username,
"LogoutType": "2"
}
Logout.logout(logoutdata)
.then(function(data){
$scope.login();
},
function(error){
$scope.message = "Oops, there has been issue.";
$scope.userAlreadyLoggedIn = false;
});
}
}
});
}());
What I have tried:
Checked the code and tinkered with setting in IIS manager