Pantalla de login con textfields + agregado caso de usuario de compras a LoginController.php

This commit is contained in:
Alejandro Tasistro 2024-09-10 22:07:11 -03:00
parent bf3f697299
commit 5f565a3f5a
3 changed files with 56 additions and 1 deletions

View File

@ -31,7 +31,9 @@ class LoginController extends Controller
protected function authenticated(Request $request, $user)
{
if ($user->is_admin) {
if ($user->is_compras) {
return redirect('compras/pedidos');
} else if ($user->is_admin) {
session(['admin_gdc' => $user->grupo_de_compra_id]);
return redirect('admin/pedidos');
} else {

View File

@ -0,0 +1,52 @@
<template>
<div class="block">
<div class="field">
<label class="label">Usuario</label>
<div class="field">
<div class="control">
<input required class="input" type="text" name="user" placeholder="Usuario">
</div>
</div>
</div>
<div class="field">
<label class="label">Contraseña</label>
<div class="field has-addons">
<div class="control">
<input required class="input" :type="this.passwordType" name="password" placeholder="Contraseña">
</div>
<div class="control">
<a class="button is-dark" @click="togglePassword">
{{ (passwordVisible ? 'Ocultar' : 'Mostrar') + ' contraseña'}}
</a>
</div>
</div>
</div>
<div class="field">
<div class="control">
<input type="submit" class="button is-dark" value="Ingresar"/>
</div>
</div>
</div>
</template>
<script>
export default {
name: "LoginAdmin",
data() {
return {
passwordVisible: false,
passwordType: "password",
}
},
methods: {
togglePassword() {
if (this.passwordVisible) this.passwordType = "password";
else this.passwordType = "text"
this.passwordVisible = !this.passwordVisible
}
}
}
</script>
<style>
</style>

View File

@ -24,6 +24,7 @@
@enderror
<form method="post" action="login">
@csrf
<login-compras></login-compras>
</form>
</div>
</section>