up
This commit is contained in:
@@ -83,14 +83,13 @@ class ShowPerfil extends Component
|
|||||||
|
|
||||||
public function confirmar()
|
public function confirmar()
|
||||||
{
|
{
|
||||||
|
|
||||||
$validatedData = $this->validate([
|
$validatedData = $this->validate([
|
||||||
'newPassword' => 'required'
|
'newPassword' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
User::where('id', Auth()->user()->id)->update([
|
$user = User::findOrFail(Auth()->user()->id);
|
||||||
'password' => Hash::make($this->newPassword),
|
$user->password = Hash::make($this->newPassword);
|
||||||
]);
|
$user->save();
|
||||||
|
|
||||||
$this->alert('success', 'Contraseña actualizada correctamente!', [
|
$this->alert('success', 'Contraseña actualizada correctamente!', [
|
||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
|
|||||||
@@ -783,14 +783,20 @@ class ShowUsuarios extends Component
|
|||||||
|
|
||||||
public function confirmarNewPassword()
|
public function confirmarNewPassword()
|
||||||
{
|
{
|
||||||
|
|
||||||
$validatedData = $this->validate([
|
$validatedData = $this->validate([
|
||||||
'newPassword' => 'required'
|
'newPassword' => 'required'
|
||||||
]);
|
]);
|
||||||
|
|
||||||
User::where('id', $this->pass_id)->update([
|
if (!$this->pass_id) {
|
||||||
'password' => Hash::make($this->newPassword),
|
$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!', [
|
$this->alert('success', 'Contraseña actualizada correctamente!', [
|
||||||
'position' => 'top'
|
'position' => 'top'
|
||||||
|
|||||||
Reference in New Issue
Block a user