Commit 88404964dd2a082bdfed85423bbfb0895cfb432e
1 parent
322a93132c
Exists in
master
and in
2 other branches
mejorar validacion con login mal seteados
Showing
1 changed file
with
6 additions
and
1 deletions
Show diff stats
src/js/controller.js
| ... | ... | @@ -5,15 +5,20 @@ angular.module('focaLogin') |
| 5 | 5 | $scope.paso = 1; |
| 6 | 6 | $scope.enviar = function() { |
| 7 | 7 | focaLoginService.login($scope.usuario).then(function(datos) { |
| 8 | - $cookies.put('token', datos.data.token); | |
| 9 | 8 | |
| 10 | 9 | if (datos.data.chofer.id) { |
| 11 | 10 | $cookies.put('chofer', datos.data.chofer.id); |
| 12 | 11 | } else if (datos.data.vendedorCobrador.CodVen) { |
| 13 | 12 | $cookies.put('vendedorCobrador', datos.data.vendedorCobrador.CodVen); |
| 13 | + } else { | |
| 14 | + focaModalService.alert('Existe un error con el usuario ingresado'); | |
| 15 | + return; | |
| 14 | 16 | } |
| 15 | 17 | |
| 18 | + | |
| 19 | + $cookies.put('token', datos.data.token); | |
| 16 | 20 | $location.path('/'); |
| 21 | + console.info(focaLoginService.getLoginData()); | |
| 17 | 22 | $scope.$emit('blur'); |
| 18 | 23 | }, function(error) { |
| 19 | 24 | if (error.status === 401) { |