dstpabuaran.com/app/Http/Controllers/Settings/SecurityController.php

40 lines
957 B
PHP

<?php
namespace App\Http\Controllers\Settings;
use App\Http\Controllers\Controller;
use App\Http\Requests\Settings\PasswordUpdateRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Validation\Rules\Password;
use Inertia\Inertia;
use Inertia\Response;
class SecurityController extends Controller
{
/**
* Show the user's security settings page.
*/
public function edit(): Response
{
$props = [
'passwordRules' => Password::defaults()->toPasswordRulesString(),
];
return Inertia::render('settings/security', $props);
}
/**
* Update the user's password.
*/
public function update(PasswordUpdateRequest $request): RedirectResponse
{
$request->user()->update([
'password' => $request->password,
]);
Inertia::flash('toast', ['type' => 'success', 'message' => 'Kata sandi berhasil diperbarui.']);
return back();
}
}