edit.blade.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. @extends('layouts.app')
  2. @section('content')
  3. <div class="container">
  4. <div class="col-12">
  5. <div class="card shadow-none border mt-5">
  6. <div class="card-body">
  7. <div class="row">
  8. <div class="col-12 p-3 p-md-5">
  9. <div class="title">
  10. <h3 class="font-weight-bold">Edit Two-Factor Authentication</h3>
  11. </div>
  12. <hr>
  13. <p class="lead pb-3">
  14. To register a new device, you have to remove any active devices.
  15. </p>
  16. <div class="card">
  17. <div class="card-header bg-light font-weight-bold">
  18. Authenticator App
  19. </div>
  20. <div class="card-body d-flex justify-content-between align-items-center">
  21. <i class="fas fa-lock fa-3x text-success"></i>
  22. <p class="font-weight-bold mb-0">
  23. Added {{$user->{'2fa_setup_at'}->diffForHumans()}}
  24. </p>
  25. </div>
  26. <div class="card-footer bg-white text-right">
  27. <a class="btn btn-outline-secondary btn-sm px-4 font-weight-bold mr-3" href="{{route('settings.security.2fa.recovery')}}">View Recovery Codes</a>
  28. <a class="btn btn-outline-danger btn-sm px-4 font-weight-bold remove-device" href="#">Remove</a>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. @endsection
  37. @push('scripts')
  38. <script type="text/javascript">
  39. $(document).ready(function() {
  40. $(document).on('click', '.remove-device', function(e) {
  41. e.preventDefault();
  42. swal({
  43. title: 'Confirm Device Removal',
  44. text: 'Are you sure you want to remove this two-factor authentication device from your account?',
  45. icon: 'warning',
  46. button: {
  47. text: 'Confirm Removal',
  48. className: 'btn-danger'
  49. }
  50. })
  51. .then((value) => {
  52. if(value == true) {
  53. swal({
  54. title: 'Are you really sure?',
  55. text: 'Are you really sure you want to remove this two-factor authentication device from your account?',
  56. icon: 'warning',
  57. button: {
  58. text: 'Confirm Removal',
  59. className: 'btn-danger'
  60. }
  61. })
  62. .then((value) => {
  63. if(value == true) {
  64. axios.post('/settings/security/2fa/edit', {
  65. action: 'remove'
  66. })
  67. .then(function(res) {
  68. window.location.href = '/settings/security';
  69. })
  70. .catch(function(res) {
  71. swal(
  72. 'Oops!',
  73. 'Something went wrong. Please try again.',
  74. 'error'
  75. );
  76. })
  77. }
  78. });
  79. }
  80. });
  81. });
  82. });
  83. </script>
  84. @endpush