Created
January 27, 2015 21:40
-
-
Save FraGoTe/3dad937869715e749a23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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; | |
} | |
}); | |
}; | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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