Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 0 additions & 32 deletions app/Http/Controllers/Settings/PasswordController.php

This file was deleted.

58 changes: 58 additions & 0 deletions app/Http/Controllers/Settings/SecurityController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Http\Controllers\Settings;

use App\Http\Controllers\Controller;
use App\Http\Requests\Settings\PasswordUpdateRequest;
use App\Http\Requests\Settings\TwoFactorAuthenticationRequest;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Controllers\HasMiddleware;
use Illuminate\Routing\Controllers\Middleware;
use Inertia\Inertia;
use Inertia\Response;
use Laravel\Fortify\Features;

class SecurityController extends Controller implements HasMiddleware
{
/**
* Get the middleware that should be assigned to the controller.
*/
public static function middleware(): array
{
return Features::canManageTwoFactorAuthentication()
&& Features::optionEnabled(Features::twoFactorAuthentication(), 'confirmPassword')
? [new Middleware('password.confirm', only: ['edit'])]
: [];
}

/**
* Show the user's security settings page.
*/
public function edit(TwoFactorAuthenticationRequest $request): Response
{
$props = [
'canManageTwoFactor' => Features::canManageTwoFactorAuthentication(),
];

if (Features::canManageTwoFactorAuthentication()) {
$request->ensureStateIsValid();

$props['twoFactorEnabled'] = $request->user()->hasEnabledTwoFactorAuthentication();
$props['requiresConfirmation'] = Features::optionEnabled(Features::twoFactorAuthentication(), 'confirm');
}

return Inertia::render('settings/Security', $props);
}

/**
* Update the user's password.
*/
public function update(PasswordUpdateRequest $request): RedirectResponse
{
$request->user()->update([
'password' => $request->password,
]);

return back();
}
}

This file was deleted.

9 changes: 0 additions & 9 deletions app/Http/Requests/Settings/TwoFactorAuthenticationRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,12 @@

use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Foundation\Http\FormRequest;
use Laravel\Fortify\Features;
use Laravel\Fortify\InteractsWithTwoFactorState;

class TwoFactorAuthenticationRequest extends FormRequest
{
use InteractsWithTwoFactorState;

/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return Features::enabled(Features::twoFactorAuthentication());
}

/**
* Get the validation rules that apply to the request.
*
Expand Down
11 changes: 3 additions & 8 deletions resources/js/layouts/settings/Layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
import { toUrl } from '@/lib/utils';
import { edit as editAppearance } from '@/routes/appearance';
import { edit as editProfile } from '@/routes/profile';
import { show } from '@/routes/two-factor';
import { edit as editPassword } from '@/routes/user-password';
import { edit as editSecurity } from '@/routes/security';
import type { NavItem } from '@/types';

let {
Expand All @@ -24,12 +23,8 @@
href: editProfile(),
},
{
title: 'Password',
href: editPassword(),
},
{
title: 'Two-factor auth',
href: show(),
title: 'Security',
href: editSecurity(),
},
{
title: 'Appearance',
Expand Down
103 changes: 0 additions & 103 deletions resources/js/pages/settings/Password.svelte

This file was deleted.

Loading
Loading