Improve login dialog.
This commit is contained in:
parent
3697ff9f21
commit
86911c106d
@ -47,21 +47,20 @@ var loginModule = angular.module('accountant.login', [
|
||||
ariaDescribedBy: 'modal-body',
|
||||
templateUrl: loginTmpl,
|
||||
controller: 'LoginModalController',
|
||||
controllerAs: '$ctrl',
|
||||
size: 'lg',
|
||||
controllerAs: '$ctrl'
|
||||
});
|
||||
|
||||
modalInstance.result.then(function (data) {
|
||||
$log.log(data);
|
||||
|
||||
// TODO Alexis Lahouze 2015-08-28 Handle callback.
|
||||
// Call to /api/login to retrieve the token
|
||||
$storage.session.set('refresh_token', data.refresh_token);
|
||||
$storage.session.set('access_token', data.access_token);
|
||||
|
||||
authService.loginConfirmed();
|
||||
}, function () {
|
||||
$log.info('Modal dismissed at: ' + new Date());
|
||||
|
||||
// FIXME Alexis Lahouze 2017-06-11 Redirect to error page.
|
||||
authService.loginCancelled(null, 'Login cancelled by user action.');
|
||||
});
|
||||
};
|
||||
@ -121,8 +120,7 @@ var loginModule = angular.module('accountant.login', [
|
||||
var email = vm.data.email;
|
||||
var password = vm.data.password;
|
||||
|
||||
$log.log(email, password);
|
||||
|
||||
// Encode authentication data.
|
||||
var authdata = base64.encode(email + ':' + password);
|
||||
|
||||
return $http.post('/api/user/login', {}, {
|
||||
@ -133,6 +131,9 @@ var loginModule = angular.module('accountant.login', [
|
||||
$log.log(result);
|
||||
|
||||
$uibModalInstance.close(result.data);
|
||||
}, function(response) {
|
||||
// FIXME Alexis Lahouze 2017-06-11 Handle error.
|
||||
$log.log("Error on login", response);
|
||||
});
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user