Commit 0a79e2b1741bb7c2c16c6317354f03dafbddb720
1 parent
0f0b69bbed
Exists in
master
and in
2 other branches
Agregado ver/ocultar contraseña.
Showing
2 changed files
with
32 additions
and
23 deletions
Show diff stats
src/js/controller.js
1 | 1 | angular.module('focaLogin') |
2 | 2 | .controller('focaLoginController', [ |
3 | 3 | '$scope', 'focaLoginService', '$location', '$cookies', 'focaModalService', 'md5', 'APP', |
4 | - function($scope, focaLoginService, $location, $cookies, focaModalService, md5, APP) { | |
4 | + function ($scope, focaLoginService, $location, $cookies, focaModalService, md5, APP) { | |
5 | 5 | $scope.paso = 1; |
6 | - $scope.enviar = function() { | |
6 | + $scope.hidePassword = true; | |
7 | + $scope.enviar = function () { | |
7 | 8 | angular.element('#password').blur(); |
8 | 9 | focaLoginService.login({ |
9 | 10 | idUsuario: $scope.usuario.idUsuario, |
10 | 11 | clave: APP != 'facturador' ? md5.createHash($scope.usuario.clave) : |
11 | 12 | $scope.usuario.clave |
12 | - }).then(function(datos) { | |
13 | + }).then(function (datos) { | |
13 | 14 | if (datos.data.chofer && datos.data.chofer.id) { |
14 | 15 | $cookies.put('chofer', datos.data.chofer.id); |
15 | 16 | $cookies.put('nombreUsuario', datos.data.chofer.nombre); |
... | ... | @@ -28,26 +29,26 @@ angular.module('focaLogin') |
28 | 29 | $cookies.put('token', datos.data.token); |
29 | 30 | $location.path('/'); |
30 | 31 | $scope.$emit('blur'); |
31 | - }, function(error) { | |
32 | + }, function (error) { | |
32 | 33 | if (error.status === 401) { |
33 | 34 | focaModalService |
34 | 35 | .alert('El usuario o la contraseña han sido mal introducidos'); |
35 | 36 | } |
36 | 37 | |
37 | - if(error.status === -1) { | |
38 | + if (error.status === -1) { | |
38 | 39 | focaModalService.alert('Sin servicio'); |
39 | 40 | return; |
40 | 41 | } |
41 | 42 | }); |
42 | 43 | }; |
43 | - $scope.irPaso = function(numeroPaso) { | |
44 | + $scope.irPaso = function (numeroPaso) { | |
44 | 45 | $scope.paso = numeroPaso; |
45 | 46 | }; |
46 | 47 | } |
47 | 48 | ]) |
48 | 49 | .controller('focaLogoutController', [ |
49 | 50 | '$cookies', '$location', |
50 | - function($cookies, $location) { | |
51 | + function ($cookies, $location) { | |
51 | 52 | $cookies.remove('chofer'); |
52 | 53 | $cookies.remove('vendedorCobrador'); |
53 | 54 | $cookies.remove('vendedorPlaya'); |
src/views/foca-login.html
... | ... | @@ -5,18 +5,18 @@ |
5 | 5 | <div class="col-8 col-sm-6 col-md-4 col-lg-3 my-2 align-self-stretch"> |
6 | 6 | <div class="bg-gradient-login border-0 rounded shadow-sm text-center"> |
7 | 7 | <form class="p-3 m-0" name="login"> |
8 | - <div class="pt-3 pb-2 border-bottom border-white"> | |
8 | + <div class="pt-3 pb-2 mb-3 border-bottom border-white"> | |
9 | 9 | <span>Ingreso de usuario</span> |
10 | 10 | </div> |
11 | 11 | <!-- USUARIO --> |
12 | - <div class="form-group my-2"> | |
13 | - <label | |
14 | - for="user" | |
15 | - class="login-small-text m-0"> | |
16 | - Usuario | |
17 | - </label> | |
12 | + <label | |
13 | + for="user" | |
14 | + class="login-small-text m-0"> | |
15 | + Usuario | |
16 | + </label> | |
17 | + <div class="input-group mb-2"> | |
18 | 18 | <input |
19 | - class="form-control form-control-sm badge-pill text-transform-none" | |
19 | + class="form-control form-control-sm rounded-pill text-transform-none" | |
20 | 20 | type="text" |
21 | 21 | id="user" |
22 | 22 | ng-model="usuario.idUsuario" |
... | ... | @@ -28,22 +28,30 @@ |
28 | 28 | /> |
29 | 29 | </div> |
30 | 30 | <!-- CONTRASEÑA --> |
31 | - <div class="form-group my-2"> | |
32 | - <label | |
33 | - for="password" | |
34 | - class="login-small-text m-0"> | |
35 | - Contraseña | |
36 | - </label> | |
31 | + <label | |
32 | + for="password" | |
33 | + class="login-small-text m-0"> | |
34 | + Contraseña | |
35 | + </label> | |
36 | + <div class="input-group mb-2"> | |
37 | 37 | <input |
38 | - class="form-control form-control-sm badge-pill" | |
38 | + class="form-control form-control-sm rounded-pill text-transform-none pr-5" | |
39 | 39 | id="password" |
40 | - type="password" | |
40 | + type="{{!hidePassword ? 'password' : 'text'}}" | |
41 | 41 | ng-model="usuario.clave" |
42 | 42 | foca-focus="paso == 2" |
43 | 43 | ng-keyup="$event.keyCode == 13 && enviar()" |
44 | 44 | ladda="loginLoading" |
45 | 45 | teclado-virtual |
46 | 46 | /> |
47 | + <div class="input-icon px-3"> | |
48 | + <div ng-show="!hidePassword" ng-click="hidePassword = !hidePassword"> | |
49 | + <i class="fade-in fa fa-eye"></i> | |
50 | + </div> | |
51 | + <div ng-show="hidePassword" ng-click="hidePassword = !hidePassword"> | |
52 | + <i class="fade-in fa fa-eye-slash"></i> | |
53 | + </div> | |
54 | + </div> | |
47 | 55 | </div> |
48 | 56 | <button |
49 | 57 | type="button" |