-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Route won't exist if 2fa is disabled
- Loading branch information
Showing
1 changed file
with
37 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,43 @@ | ||
<script> | ||
|
||
$( '.table' ).on( 'click', '.remove-2fa', function( event ) { | ||
|
||
event.preventDefault(); | ||
|
||
let objectId = $( "#" + this.id ).attr( "data-object-id" ); | ||
|
||
let html = `<p>Do you really want to delete the 2FA for this user?</p> | ||
<form id="d2f-form-delete" method="POST" action="<?= route('2fa@delete' ) ?>"> | ||
<input type="hidden" name="_token" value="<?= csrf_token() ?>"> | ||
<input type="hidden" name="id" value="${objectId}"> | ||
</form>`; | ||
|
||
bootbox.dialog({ | ||
message: html, | ||
title: "Delete 2FA", | ||
buttons: { | ||
cancel: { | ||
label: 'Close', | ||
className: 'btn-secondary', | ||
callback: function () { | ||
$('.bootbox.modal').modal('hide'); | ||
return false; | ||
} | ||
}, | ||
submit: { | ||
label: 'Delete', | ||
className: 'btn-danger', | ||
callback: function () { | ||
$('#d2f-form-delete').submit(); | ||
} | ||
}, | ||
} | ||
<?php if( config( 'google2fa.enabled' ) ): ?> | ||
|
||
$( '.table' ).on( 'click', '.remove-2fa', function( event ) { | ||
|
||
event.preventDefault(); | ||
|
||
let objectId = $( "#" + this.id ).attr( "data-object-id" ); | ||
|
||
let html = `<p>Do you really want to delete the 2FA for this user?</p> | ||
<form id="d2f-form-delete" method="POST" action="<?= route('2fa@delete' ) ?>"> | ||
<input type="hidden" name="_token" value="<?= csrf_token() ?>"> | ||
<input type="hidden" name="id" value="${objectId}"> | ||
</form>`; | ||
|
||
bootbox.dialog({ | ||
message: html, | ||
title: "Delete 2FA", | ||
buttons: { | ||
cancel: { | ||
label: 'Close', | ||
className: 'btn-secondary', | ||
callback: function () { | ||
$('.bootbox.modal').modal('hide'); | ||
return false; | ||
} | ||
}, | ||
submit: { | ||
label: 'Delete', | ||
className: 'btn-danger', | ||
callback: function () { | ||
$('#d2f-form-delete').submit(); | ||
} | ||
}, | ||
} | ||
}); | ||
|
||
}); | ||
|
||
}); | ||
<?php endif; ?> | ||
|
||
</script> |