Skip to content

Commit

Permalink
feature: add confirm password
Browse files Browse the repository at this point in the history
  • Loading branch information
muco-rolle committed Oct 21, 2024
1 parent 8b9d192 commit 3291900
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ConfirmablePasswordController extends Controller
*/
public function show(): Response
{
return Inertia::render('Auth/ConfirmPassword');
return Inertia::render('auth/password/confirm');
}

/**
Expand Down
4 changes: 0 additions & 4 deletions app/Http/Controllers/Auth/PasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@

use App\Data\Auth\PasswordData;
use App\Http\Controllers\Controller;
use App\Models\User;
use Auth;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Validation\Rules\Password;

class PasswordController extends Controller
{
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/Auth/PasswordResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace App\Http\Controllers\Auth;

use App\Data\Auth\PasswordResetData;
use App\Enums\FlashMessageType;
use App\Http\Controllers\Controller;
use App\Pages\PasswordResetCreatePage;
use Illuminate\Auth\Events\PasswordReset;
Expand Down
3 changes: 0 additions & 3 deletions app/Http/Controllers/Auth/PasswordResetLinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
use App\Data\Auth\PasswordResetLinkData;
use App\Http\Controllers\Controller;
use App\Pages\PasswordResetLinkCreatePage;
use Illuminate\Auth\Events\PasswordResetLinkSent;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Password;
use Illuminate\Validation\ValidationException;
use Inertia\{Response, ResponseFactory};
use Symfony\Component\HttpFoundation\Exception\BadRequestException;

class PasswordResetLinkController extends Controller
{
Expand Down
1 change: 0 additions & 1 deletion app/Http/Controllers/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace App\Http\Controllers;

use App\Data\Auth\AccountDeleteData;
use App\Data\ProfileData;
use App\Models\User;
use App\Pages\ProfileEditPage;
Expand Down
48 changes: 48 additions & 0 deletions resources/views/pages/auth/password/confirm.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { useForm } from '@inertiajs/react'
import { Button, PasswordInput } from '@mantine/core'
import AuthLayout from '~/views/layouts/auth'

export default function AuthPasswordConfirmPage() {
const form = useForm<{ password: string }>({
password: '',
})

return (
<AuthLayout
title="Confirm Password"
intro={
<p>
This is a secure area of the application. Please confirm your password
before continuing.
</p>
}
>
<form
className="flex w-full flex-col items-center justify-end gap-10"
onSubmit={(event) => {
event.preventDefault()

form.post(route('password.confirm'), {
onFinish: () => form.reset('password'),
})
}}
>
<div className="w-full">
<PasswordInput
name="password"
label="Password"
placeholder="Password"
error={form.errors.password}
value={form.data.password}
onChange={(event) => {
form.setData('password', event.target.value)
}}
/>
</div>
<Button type="submit" loading={form.processing} fullWidth>
Confirm
</Button>
</form>
</AuthLayout>
)
}
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

Route::get('/dashboard', function () {
return inertia("dashboard/index");
})->middleware(['auth', "verified"])->name('dashboard');
})->middleware(['auth', "verified", "password.confirm"])->name('dashboard');


Route::middleware('auth')->group(function () {
Expand Down
4 changes: 0 additions & 4 deletions storage_/app/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/app/private/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/app/public/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions storage_/framework/.gitignore

This file was deleted.

3 changes: 0 additions & 3 deletions storage_/framework/cache/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/framework/cache/data/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/framework/sessions/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/framework/testing/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/framework/views/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/logs/.gitignore

This file was deleted.

2 changes: 0 additions & 2 deletions storage_/pail/.gitignore

This file was deleted.

0 comments on commit 3291900

Please sign in to comment.