Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'use strict';
angular.module('Authentication', ['TCS'])
.controller('LoginController',
['$scope', '$rootScope', '$location', 'AuthenticationService',
function ($scope, $rootScope, $location, AuthenticationService, tcs_modal) {
// reset login status
AuthenticationService.ClearCredentials();
$scope.login = function (user) {
tcs_modal(1, 'Cargando ...', '');
console.log('xx');
AuthenticationService.Login(user.username, user.password, function(response) {
if(response.transaccion === SUCCESS) {
// TCS.modal(0, '', '');
$scope.v_success = true;
$scope.v_error = false;
$scope.v_mensaje = response.mensaje;
AuthenticationService.SetCredentials(user.username, user.password);
$location.path('/');
} else {
// TCS.modal(0, '', '');
$scope.v_success = false;
$scope.v_error = true;
$scope.v_mensaje = response.mensaje;
}
});
};
}]);
'use strict';
angular.module('TCS', [])
.factory('tcs_modal', function(mostrar, mensaje, mensajeHtml) {
var modalTrns = 'hide';
if (mostrar === 1) {
modalTrns = 'show';
}
$.mobile.loading( modalTrns, {
text: mensaje,
textVisible: true,
theme: 'b',
html: mensajeHtml
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment