Skip to content

Commit

Permalink
Add "Return to Login Options" button to authentication, register and …
Browse files Browse the repository at this point in the history
…setup views
  • Loading branch information
doncho-toromanov committed Oct 29, 2024
1 parent ce240ef commit 02fdd48
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion config/nova-google2fa.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,7 @@
'app_store_links' => [
'android' => 'https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en&gl=US',
'ios' => 'https://apps.apple.com/lv/app/google-authenticator/id388497605',
]
],

'logout_route_name' => 'nova.logout',
];
1 change: 1 addition & 0 deletions resources/lang/en/2fa-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'confirm' => 'Confirm',
'recovery_login' => 'Log in using recovery code?',
'reset' => 'Reset two-factor auth',
'logout' => 'Return to Login Options',
],

'fields' => [
Expand Down
6 changes: 6 additions & 0 deletions resources/views/controllers/authentication.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
</div>
<div
class="my-8 flex flex-col md:flex-row md:items-center justify-center space-y-2 md:space-y-0 space-x-3">
<a href="" onclick="event.preventDefault(); document.getElementById('form-logout').submit();"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900">
{{ __('nova-google2fa::2fa-auth.actions.logout') }}
</a>
<button type="submit"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900">
<span>{{ __('nova-google2fa::2fa-auth.actions.login') }}</span>
Expand All @@ -26,4 +30,6 @@ class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-
</div>
</div>
</form>

@include('nova-google2fa::partials.logout-form')
@endsection
6 changes: 6 additions & 0 deletions resources/views/controllers/register.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@
</div>
<div
class="my-8 flex flex-col md:flex-row md:items-center justify-center space-y-2 md:space-y-0 space-x-3">
<a href="" onclick="event.preventDefault(); document.getElementById('form-logout').submit();"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900">
{{ __('nova-google2fa::2fa-auth.actions.logout') }}
</a>
<button type="submit"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900">
<span>{{ __('nova-google2fa::2fa-auth.actions.confirm') }}</span>
</button>
</div>
</div>
</form>

@include('nova-google2fa::partials.logout-form')
@endsection
1 change: 1 addition & 0 deletions resources/views/controllers/setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

<div
class="my-8 flex flex-col md:flex-row md:items-center justify-center md:justify-end space-y-2 md:space-y-0 space-x-3">
@include('nova-google2fa::partials.logout-form', ['withSubmitButton' => true])
<button type="button"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900"
onclick="window.print()"
Expand Down
14 changes: 14 additions & 0 deletions resources/views/partials/logout-form.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@php
$withSubmitButton = $withSubmitButton ?? false;
@endphp

<form id="form-logout" method="POST" action="{{ route(config('nova-google2fa.logout_route_name')) }}">
@csrf
@if ($withSubmitButton)
<button type="submit"
class="shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900 cursor-pointer rounded text-sm font-bold focus:outline-none focus:ring ring-primary-200 dark:ring-gray-600 inline-flex items-center justify-center h-9 px-3 shadow relative bg-primary-500 hover:bg-primary-400 text-white dark:text-gray-900"
>
<span>{{ __('nova-google2fa::2fa-auth.actions.logout') }}</span>
</button>
@endif
</form>

0 comments on commit 02fdd48

Please sign in to comment.