mirror of
https://github.com/fergalmoran/roboto-promoto.git
synced 2025-12-22 09:37:37 +00:00
26 lines
614 B
JavaScript
26 lines
614 B
JavaScript
'use strict';
|
|
|
|
angular.module('robotoPromotoApp')
|
|
.controller('LoginCtrl', function ($scope, Auth, $location) {
|
|
$scope.user = {};
|
|
$scope.errors = {};
|
|
|
|
$scope.login = function(form) {
|
|
$scope.submitted = true;
|
|
|
|
if(form.$valid) {
|
|
Auth.login({
|
|
email: $scope.user.email,
|
|
password: $scope.user.password
|
|
})
|
|
.then( function() {
|
|
// Logged in, redirect to home
|
|
$location.path('/');
|
|
})
|
|
.catch( function(err) {
|
|
err = err.data;
|
|
$scope.errors.other = err.message;
|
|
});
|
|
}
|
|
};
|
|
}); |