Files
brewman/brewman/brewman/static/scripts/login.js
Tanshu 7594fd399a Product Ledger Role missed earlier, fixed.
Almost all reports are using resolve now to prevent flicker when data is loading.
2012-10-28 17:04:05 +05:30

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});
});
}