Skip to content
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
33 changes: 33 additions & 0 deletions resources/views/livewire/two-factor-auth-form.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,39 @@ class="form__button form__button--filled"
>
{{ __('Regenerate Recovery Codes') }}
</button>
@script
<script
nonce="{{ HDVinnie\SecureHeaders\SecureHeaders::nonce('script') }}"
>
Alpine.data('recovery_codes', () => ({
copy() {
navigator.clipboard.writeText(
JSON.parse(
atob(
'{{ base64_encode(decrypt($this->user->two_factor_recovery_codes)) }}',
),
).join('\n'),
);
Swal.fire({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000,
icon: 'success',
title: 'Copied to clipboard!',
});
},
}));
</script>
@endscript

<button
class="form__button form__button--filled"
x-data="recovery_codes"
x-on:click.stop="copy"
>
{{ __('Copy Recovery Codes') }}
</button>
@elseif ($showingConfirmation)
<button
class="form__button form__button--filled"
Expand Down