feat: 2fa reset notifs

Signed-off-by: miguel456 <me@nogueira.codes>
This commit is contained in:
2022-09-21 05:43:11 +01:00
parent 3122c23eb4
commit f3996bb68c
9 changed files with 141 additions and 10 deletions

View File

@@ -15,9 +15,37 @@
@section('content')
<x-modal id="resetAccountPasswordModal" modal-label="resetAccountPassword" modal-title="{{ __('Confirm your password') }}" include-close-button="true">
@if($user->has2FA())
<p>{{ __('Please confirm that you want to invalidate this account\'s password. Since this is a sensitive operation, you\'ll need to confirm your own password and provide a 2FA code, if enabled.') }}</p>
<x-modal id="resetTwoFactorModal" modal-label="resetTwoFactor" modal-title="{{ __('Verify your identity') }}" include-close-button="true">
<p>{{ __('Resetting an account\'s two-factor authentication secret will automatically notify the account holder. Additionally, the user\'s password will also be forcefully reset during this process. Please confirm this action by verifying your identity below.') }}</p>
<form id="resetAccountTwofaForm" method="POST" action="{{ route('reset-twofa', ['user' => $user]) }}">
@csrf
@method('PATCH')
<x-confirm-password>
{{ __('Please re-enter your password.') }}
</x-confirm-password>
<x-confirm-second-factor>
{{ __('Please enter your two-factor authentication code.') }}
</x-confirm-second-factor>
</form>
<x-slot:modalFooter>
<button onclick="$('#resetAccountTwofaForm').submit()" type="button" class="btn btn-warning"><i class="fas fa-check"></i> {{ __('Re-authenticate and verify') }}</button>
</x-slot:modalFooter>
</x-modal>
@endif
<x-modal id="resetAccountPasswordModal" modal-label="resetAccountPassword" modal-title="{{ __('Verify your identity') }}" include-close-button="true">
<p>{{ __('Forcing a password reset will automatically notify the account holder and send them a password reset link. Please confirm this action by verifying your identity below.') }}</p>
<form id="resetAccountPasswordForm" method="POST" action="{{ route('force-reset-user', ['user' => $user]) }}">
@csrf
@@ -34,7 +62,7 @@
</form>
<x-slot name="modalFooter">
<button onclick="$('#resetAccountPasswordForm').submit()" type="button" class="btn btn-warning"><i class="fas fa-check"></i> {{ __('Re-authenticate and confirm') }}</button>
<button onclick="$('#resetAccountPasswordForm').submit()" type="button" class="btn btn-warning"><i class="fas fa-check"></i> {{ __('Re-authenticate and verify') }}</button>
</x-slot>
</x-modal>
@@ -388,7 +416,9 @@
</form>
@endif
<button onclick="$('#resetAccountPasswordModal').modal('show')" class="btn-danger btn mr-3" type="button"><i class="fas fa-key"></i> {{ __('Force password reset') }}</button>
<button class="btn-danger btn mr-3" type="button"><i class="fas fa-unlock"></i> {{ __('Reset MFA') }}</button>
@if($user->has2FA())
<button onclick="$('#resetTwoFactorModal').modal('show')" class="btn-danger btn mr-3" type="button"><i class="fas fa-unlock"></i> {{ __('Reset MFA') }}</button>
@endif
<button onclick="$('#deleteAccount').modal('show')" type="button" class="btn btn-danger"><i class="fas fa-trash"></i> {{ __('Delete account') }}</button>
</div>
</div>