39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Auth;
|
|
|
|
use App\Facades\Audit;
|
|
use App\Http\Controllers\Controller;
|
|
use App\Http\Requests\Auth\ChangePasswordRequest;
|
|
use App\Services\Auth\PasswordManager;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
/**
|
|
* Смена пароля пользователем, в т.ч. принудительная по истечении срока.
|
|
*
|
|
* Меры ФСТЭК: ИАФ.3 (управление аутентификационной информацией), РСБ.2.
|
|
*/
|
|
class PasswordController extends Controller
|
|
{
|
|
public function __construct(private readonly PasswordManager $passwords) {}
|
|
|
|
/**
|
|
* Экран принудительной смены пароля (срок истёк).
|
|
*/
|
|
public function expired(): Response
|
|
{
|
|
return Inertia::render('auth/PasswordExpired');
|
|
}
|
|
|
|
public function update(ChangePasswordRequest $request): RedirectResponse
|
|
{
|
|
$this->passwords->change($request->user(), $request->string('password'));
|
|
|
|
Audit::log('auth.password.changed', 'change', 'User:'.$request->user()->id);
|
|
|
|
return redirect()->route('dashboard')->with('status', 'Пароль обновлён.');
|
|
}
|
|
}
|