dstpabuaran.com/app/Http/Controllers/Settings/SecurityController.php
Yoga Pangestu aecd8eaf1f Refactor security settings page and update password functionality
- Translated UI elements to Indonesian for better localization.
- Improved layout by introducing Card components for better visual structure.
- Removed unnecessary imports and props related to passkeys and two-factor authentication.
- Updated tests to cover new password update scenarios and validation rules.
- Ensured proper redirection and error handling for unauthorized access to security settings.
- Enhanced user experience by adding success flash messages on password updates.
2026-07-30 22:08:24 +07:00

41 lines
958 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();
}
}