From ca0636f81c9d7a3ed365a638f75a337622bd04df Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 5 Jun 2026 10:12:46 -0500 Subject: [PATCH] up --- app/Http/Livewire/ShowPerfil.php | 7 +++---- app/Http/Livewire/ShowUsuarios.php | 14 ++++++++++---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/app/Http/Livewire/ShowPerfil.php b/app/Http/Livewire/ShowPerfil.php index 788cfe1..b17f955 100755 --- a/app/Http/Livewire/ShowPerfil.php +++ b/app/Http/Livewire/ShowPerfil.php @@ -83,14 +83,13 @@ class ShowPerfil extends Component public function confirmar() { - $validatedData = $this->validate([ 'newPassword' => 'required' ]); - User::where('id', Auth()->user()->id)->update([ - 'password' => Hash::make($this->newPassword), - ]); + $user = User::findOrFail(Auth()->user()->id); + $user->password = Hash::make($this->newPassword); + $user->save(); $this->alert('success', 'Contraseña actualizada correctamente!', [ 'position' => 'top' diff --git a/app/Http/Livewire/ShowUsuarios.php b/app/Http/Livewire/ShowUsuarios.php index dc1b0e2..8fd0a8e 100755 --- a/app/Http/Livewire/ShowUsuarios.php +++ b/app/Http/Livewire/ShowUsuarios.php @@ -783,14 +783,20 @@ class ShowUsuarios extends Component public function confirmarNewPassword() { - $validatedData = $this->validate([ 'newPassword' => 'required' ]); - User::where('id', $this->pass_id)->update([ - 'password' => Hash::make($this->newPassword), - ]); + if (!$this->pass_id) { + $this->alert('error', 'Error: no se encontró el usuario.', [ + 'position' => 'top' + ]); + return; + } + + $user = User::findOrFail($this->pass_id); + $user->password = Hash::make($this->newPassword); + $user->save(); $this->alert('success', 'Contraseña actualizada correctamente!', [ 'position' => 'top'