First commit

This commit is contained in:
2015-09-10 14:02:43 +00:00
commit ab624930df
25 changed files with 933 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
(function() {
'use strict';
angular
.module('cloudbudget')
.controller('LoginController', LoginController);
LoginController.$inject = ['$location', 'AuthenticationService', 'FlashService'];
function LoginController($location, AuthenticationService, FlashService) {
var vm = this;
vm.login = login;
(function initController() {
AuthenticationService.clearCredentials();
})();
function login() {
vm.dataLoading = true;
AuthenticationService.login(vm.username, vm.password).then( function(response) {
if( response.success ) {
AuthenticationService.setCredentials(response.user);
$location.path('/');
} else {
FlashService.error(response.message);
vm.dataLoading = false;
}
});
}
}
})();