Skip to content

Commit

Permalink
Route won't exist if 2fa is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
barryo committed Feb 29, 2020
1 parent 61d6003 commit 6505be6
Showing 1 changed file with 37 additions and 33 deletions.
70 changes: 37 additions & 33 deletions resources/views/user/js/delete-2fa.foil.php
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>

0 comments on commit 6505be6

Please sign in to comment.