26 lines
804 B
JavaScript
26 lines
804 B
JavaScript
function LoginCtrl($scope, $http, $location) {
|
|
$scope.submit = function () {
|
|
$http.
|
|
post('/login', {'username':$scope.name, 'password':$scope.password}).
|
|
success(function () {
|
|
$location.path('/')
|
|
}).
|
|
error(function (errorMessage) {
|
|
$scope.toasts.push({Type:'Error', Message:errorMessage});
|
|
});
|
|
}
|
|
$('#username').focus();
|
|
}
|
|
|
|
function LogoutCtrl($rootScope, $scope, $http, $location) {
|
|
$http.
|
|
post('/logout').
|
|
success(function () {
|
|
$scope.toasts.push({Type:'Success', Message:'Logged out'});
|
|
$location.path('/')
|
|
}).
|
|
error(function (errorMessage) {
|
|
$scope.toasts.push({Type:'Error', Message:errorMessage});
|
|
});
|
|
}
|