diff --git a/Web-Application/Fortify/app/Models/User.php b/Web-Application/Fortify/app/Models/User.php index 8101243..a6a0344 100644 --- a/Web-Application/Fortify/app/Models/User.php +++ b/Web-Application/Fortify/app/Models/User.php @@ -6,11 +6,12 @@ use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; +use Laravel\Fortify\TwoFactorAuthenticatable; class User extends Authenticatable implements MustVerifyEmail { /** @use HasFactory<\Database\Factories\UserFactory> */ - use HasFactory, Notifiable; + use HasFactory, Notifiable, TwoFactorAuthenticatable; /** * The attributes that are mass assignable. diff --git a/Web-Application/Fortify/app/Providers/FortifyServiceProvider.php b/Web-Application/Fortify/app/Providers/FortifyServiceProvider.php index 1722cda..0d3d51a 100644 --- a/Web-Application/Fortify/app/Providers/FortifyServiceProvider.php +++ b/Web-Application/Fortify/app/Providers/FortifyServiceProvider.php @@ -63,5 +63,13 @@ class FortifyServiceProvider extends ServiceProvider Fortify::resetPasswordView(function (Request $request) { return view('auth.reset-password', ['request' => $request]); }); + + Fortify::confirmPasswordView(function () { + return view('auth.confirm-password'); + }); + + Fortify::twoFactorChallengeView(function () { + return view('auth.two-factor-challange'); + }); } } diff --git a/Web-Application/Fortify/config/fortify.php b/Web-Application/Fortify/config/fortify.php index 0551d1d..331eef3 100644 --- a/Web-Application/Fortify/config/fortify.php +++ b/Web-Application/Fortify/config/fortify.php @@ -150,7 +150,7 @@ return [ Features::updateProfileInformation(), Features::updatePasswords(), Features::twoFactorAuthentication([ - 'confirm' => true, + // 'confirm' => true, 'confirmPassword' => true, // 'window' => 0, ]), diff --git a/Web-Application/Fortify/resources/views/auth/confirm-password.blade.php b/Web-Application/Fortify/resources/views/auth/confirm-password.blade.php new file mode 100644 index 0000000..c93a426 --- /dev/null +++ b/Web-Application/Fortify/resources/views/auth/confirm-password.blade.php @@ -0,0 +1,39 @@ +@extends('app') + +@section('content') +
+
+

Confirm Password

+ + @if (session()->has('error')) +
{{ session('error') }}
+ @endif + + +
+ @csrf +
+ + + + @error('password') + {{ $message }} + @enderror +
+ + + + @if (Route::has('password.request')) + + {{ __('Forgot Your Password?') }} + + @endif +
+
+
+@endsection \ No newline at end of file diff --git a/Web-Application/Fortify/resources/views/auth/two-factor-challange.blade.php b/Web-Application/Fortify/resources/views/auth/two-factor-challange.blade.php new file mode 100644 index 0000000..a220597 --- /dev/null +++ b/Web-Application/Fortify/resources/views/auth/two-factor-challange.blade.php @@ -0,0 +1,54 @@ +@extends('app') + +@section('content') +
+
+

Two Factor Secret Code

+ +
+

+ Please enter your secret code to login +

+
+ @csrf +
+ + +

@error('code') {{ $message }} @enderror

+
+
+ +
+
+
+
+ +
+

Two Factor Recovery Code

+ +
+

+ Please enter your recovery code to login +

+
+ @csrf +
+ + +

@error('recovery_code') {{ $message }} @enderror

+
+
+ +
+
+
+
+
+@endsection \ No newline at end of file diff --git a/Web-Application/Fortify/resources/views/dashboard.blade.php b/Web-Application/Fortify/resources/views/dashboard.blade.php index bfc0aa8..f5bdc72 100644 --- a/Web-Application/Fortify/resources/views/dashboard.blade.php +++ b/Web-Application/Fortify/resources/views/dashboard.blade.php @@ -15,10 +15,10 @@
-
+ @csrf + class="block text-center w-full border border-red-500 text-red-500 hover:bg-red-500 hover:text-white transition-all duration-300 rounded-lg py-2 cursor-pointer">Logout
@@ -27,6 +27,49 @@

{{ auth()->user()->email }}

+ + @if (session('status') === 'two-factor-authentication-enabled') +
+ Two-Factor Authentication is enabled! +
+ @endif + + @if (session('status') === 'two-factor-authentication-disabled') +
+ Two-Factor Authentication is disabled. +
+ @endif + +
+ @csrf + @if (Auth::user()->two_factor_secret) + @method('DELETE') + +
{!! Auth::user()->twoFactorQrCodeSvg() !!}
+ +
+

Recovery Codes

+
    + @foreach (json_decode(decrypt(auth()->user()->two_factor_recovery_codes)) as $recovery_code) +
  • + {{ $recovery_code }} +
  • + @endforeach +
+
+ + + @else + + @endif +