mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-04-22 18:20:31 -05:00
(Add) Button to copy 2fa recovery codes (#4874)
* Convert pre to div Fix https://github.com/HDInnovations/UNIT3D/issues/4873 * Undo change to div and add copy button * Get rid of init wait * Put script first * Directly define function * Revert "Directly define function" This reverts commit629248a6a5. * Revert "Put script first" This reverts commitb1d8ac894b. * Revert "Get rid of init wait" This reverts commit79d77ab8ab. * Remove dash * Finally fix * Use two words with underscore * Run prettier * automation: prettier blade ci * Apply suggestion from @PythonCoderAS --------- Co-authored-by: HDVinnie <hdinnovations@protonmail.com> Co-authored-by: unit3d-bot <unit3d_gh_bot@protonmail.com>
This commit is contained in:
@@ -101,6 +101,39 @@
|
||||
>
|
||||
{{ __('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"
|
||||
|
||||
Reference in New Issue
Block a user