22 lines
641 B
JavaScript
22 lines
641 B
JavaScript
netstix.controller('LoginController', ['UserAuth', '$window', '$scope', function(UserAuth, $window, $scope) {
|
|
var self = this;
|
|
|
|
self.login = function() {
|
|
$scope.error = false;
|
|
$scope.disabled = true;
|
|
|
|
UserAuth.login($scope.loginForm.username, $scope.loginForm.password)
|
|
.then(function () {
|
|
$window.location.href ='/#/achievements';
|
|
$scope.disabled = false;
|
|
$scope.loginForm = {};
|
|
})
|
|
.catch(function () {
|
|
$scope.error = true;
|
|
$scope.errorMessage = "Invalid username and/or password";
|
|
$scope.disabled = false;
|
|
$scope.loginForm = {};
|
|
});
|
|
};
|
|
}]);
|