Some checks failed
tests / ci (pull_request) Has been cancelled
- Moved profile and security settings from the general settings route to a dedicated admin settings route. - Created new components and pages for managing user profile and security settings. - Updated user menu to link to the new admin settings pages. - Removed old settings pages and routes that are no longer in use. - Added tests for profile and security settings functionality.
38 lines
949 B
PHP
38 lines
949 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Settings;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Admin\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
|
|
{
|
|
return Inertia::render('admin/settings/security', [
|
|
'passwordRules' => Password::defaults()->toPasswordRulesString(),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* 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();
|
|
}
|
|
}
|