Agregue boton de Ojo para ver contraseña en el login, usando JQuery
This commit is contained in:
@@ -120,3 +120,12 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
|
||||
})
|
||||
|
||||
// Ver contraseña, con JQuery
|
||||
$(document).on('click', '#togglePassword', function () {
|
||||
const input = $('#passwordInput');
|
||||
const isPassword = input.attr('type') === 'password';
|
||||
|
||||
input.attr('type', isPassword ? 'text' : 'password');
|
||||
$('#iconShow').toggleClass('hidden', isPassword);
|
||||
$('#iconHide').toggleClass('hidden', !isPassword);
|
||||
});
|
||||
@@ -2,43 +2,86 @@
|
||||
|
||||
<div class="justify-center">
|
||||
<x-section-header
|
||||
subtitle="Inicio de sesion"
|
||||
title="Bicicletería "
|
||||
highlight="Lauck"
|
||||
/>
|
||||
<div class="bg-panel-bg p-8 rounded-xl shadow-lg w-full max-w-md border border-neutral-700">
|
||||
<form action="{{ route('login.attempt') }}" method="POST" class="space-y-5">
|
||||
@csrf
|
||||
{{-- Bloque de errores --}}
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-900 border border-red-700 text-white p-3 rounded-md">
|
||||
<p class="text-sm font-medium">
|
||||
{{ $errors->first() }}
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
subtitle="Inicio de sesion"
|
||||
title="Bicicletería "
|
||||
highlight="Lauck"
|
||||
/>
|
||||
|
||||
<div>
|
||||
<x-forms.label class="block text-sm font-bold text-gray-600 mb-1">Correo electrónico</x-forms.label>
|
||||
<x-forms.input type="email" name="email" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-lime-400 text-gray-600"/>
|
||||
<div class="bg-white border border-neutral-200 shadow-sm
|
||||
dark:bg-neutral-900/50 dark:border-neutral-800
|
||||
p-8 rounded-xl w-full max-w-md">
|
||||
|
||||
<form action="{{ route('login.attempt') }}" method="POST" class="space-y-5">
|
||||
@csrf
|
||||
|
||||
{{-- Bloque de errores --}}
|
||||
@if ($errors->any())
|
||||
<div class="bg-red-100 border border-red-300 text-red-800
|
||||
dark:bg-red-900 dark:border-red-700 dark:text-white
|
||||
p-3 rounded-md">
|
||||
<p class="text-sm font-medium">
|
||||
{{ $errors->first() }}
|
||||
</p>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div>
|
||||
<x-forms.label class="block text-sm font-bold text-gray-600 mb-1">Contraseña</x-forms.label>
|
||||
<x-forms.input type="password" name="password" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-lime-400 text-gray-600"/>
|
||||
<div>
|
||||
<x-forms.label class="block text-sm font-bold mb-1
|
||||
text-neutral-700 dark:text-gray-400">
|
||||
Correo electrónico
|
||||
</x-forms.label>
|
||||
<x-forms.input type="email" name="email" required
|
||||
class="w-full px-4 py-2 rounded-md focus:outline-none focus:ring-2 focus:ring-lime-400
|
||||
border border-neutral-300 bg-white text-neutral-900
|
||||
dark:border-neutral-700 dark:bg-neutral-800 dark:text-white"/>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<x-forms.label class="block text-sm font-bold mb-1
|
||||
text-neutral-700 dark:text-gray-400">
|
||||
Contraseña
|
||||
</x-forms.label>
|
||||
<div class="relative">
|
||||
<x-forms.input id="passwordInput" type="password" name="password" required
|
||||
class="w-full px-4 py-2 pr-12 rounded-md focus:outline-none focus:ring-2 focus:ring-lime-400
|
||||
border border-neutral-300 bg-white text-neutral-900
|
||||
dark:border-neutral-700 dark:bg-neutral-800 dark:text-white"/>
|
||||
<button type="button" id="togglePassword"
|
||||
class="absolute right-3 top-1/2 -translate-y-1/2 text-neutral-400 hover:text-neutral-700 dark:hover:text-white transition-colors">
|
||||
{{-- Ojo abierto --}}
|
||||
<svg id="iconShow" xmlns="http://www.w3.org/2000/svg" class="w-5 h-5" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M15 12a3 3 0 11-6 0 3 3 0 016 0z" />
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M2.458 12C3.732 7.943 7.523 5 12 5c4.477 0 8.268 2.943 9.542 7-1.274 4.057-5.065 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" />
|
||||
</svg>
|
||||
{{-- Ojo cerrado --}}
|
||||
<svg id="iconHide" xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 hidden" fill="none"
|
||||
viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
|
||||
d="M13.875 18.825A10.05 10.05 0 0112 19c-4.477 0-8.268-2.943-9.542-7a9.956 9.956 0 012.293-3.95M6.938 6.938A9.956 9.956 0 0112 5c4.477 0 8.268 2.943 9.542 7a9.97 9.97 0 01-1.88 3.118M3 3l18 18" />
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="submit" name="submit" value="Iniciar sesión"
|
||||
class="w-full bg-lime-400 font-bold text-white py-2 rounded-md hover:bg-lime-500 transition-colors">
|
||||
</div>
|
||||
<div>
|
||||
<input type="submit" name="submit" value="Iniciar sesión"
|
||||
class="w-full font-bold py-2 rounded-md transition-colors cursor-pointer
|
||||
bg-neutral-900 text-white hover:bg-neutral-700
|
||||
dark:bg-neon-lime dark:text-neutral-900 dark:hover:bg-[#b3e600]">
|
||||
</div>
|
||||
|
||||
<p class="text-center text-sm text-gray-600">
|
||||
¿No tienes una cuenta? <a href="register" class="text-blue-600 hover:underline">Regístrate acá</a>.
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
<p class="text-center text-sm text-neutral-500 dark:text-gray-400">
|
||||
¿No tienes una cuenta?
|
||||
<a href="register" class="font-semibold text-neutral-900 hover:underline dark:text-neon-lime">
|
||||
Regístrate acá
|
||||
</a>
|
||||
</p>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</x-layout>
|
||||
Reference in New Issue
Block a user