sudo.blade.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. @extends('layouts.blank')
  2. @push('styles')
  3. <link href="{{ mix('css/landing.css') }}" rel="stylesheet">
  4. <link rel="preload" as="image" href="{{ url('/_landing/bg.jpg')}}" />
  5. @endpush
  6. @section('content')
  7. <div class="page-wrapper">
  8. <div class="container mt-5">
  9. <div class="row justify-content-center">
  10. <div class="col-lg-5">
  11. <div class="text-center">
  12. <a href="/">
  13. <img src="/img/pixelfed-icon-white.svg" height="60px">
  14. </a>
  15. <h1 class="pt-4 pb-1">Sudo Mode</h1>
  16. <p class="font-weight-light lead pb-2">Confirm password to continue</p>
  17. </div>
  18. <div class="card bg-glass">
  19. <div class="card-body">
  20. <form method="POST" id="sudoForm">
  21. @csrf
  22. <div class="form-group">
  23. <label class="font-weight-bold small text-muted">Confirm Password</label>
  24. <input
  25. id="password"
  26. type="password"
  27. class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}"
  28. name="password"
  29. autocomplete="new-password"
  30. placeholder="{{__('Password')}}"
  31. required>
  32. @if ($errors->has('password'))
  33. <span class="invalid-feedback">
  34. <strong>{{ $errors->first('password') }}</strong>
  35. </span>
  36. @endif
  37. </div>
  38. <div class="form-group" id="trusted-device-wrapper">
  39. <div class="custom-control custom-checkbox">
  40. <input type="checkbox" class="custom-control-input" name="trustDevice" id="trusted-device">
  41. <label class="custom-control-label text-muted" for="trusted-device">Trust this device and don't ask again</label>
  42. </div>
  43. </div>
  44. <div class="form-group row mb-0">
  45. <div class="col-md-12">
  46. <button
  47. type="button"
  48. id="sbtn"
  49. class="btn btn-success rounded-pill btn-block font-weight-bold"
  50. onclick="event.preventDefault();handleSubmit()">
  51. {{ __('Confirm Password') }}
  52. </button>
  53. </div>
  54. </div>
  55. </form>
  56. </div>
  57. </div>
  58. <div class="d-flex justify-content-between my-3">
  59. <p class="mb-0 small">
  60. <span class="text-muted">Logged in as:</span> {{request()->user()->username}}
  61. </p>
  62. <form action="/logout" method="post">
  63. @csrf
  64. <button type="submit" class="btn btn-link p-0 btn-sm text-white font-weight-bold">Logout</button>
  65. </form>
  66. </div>
  67. </div>
  68. </div>
  69. </div>
  70. </div>
  71. @endsection
  72. @push('scripts')
  73. <script type="text/javascript">
  74. function handleSubmit() {
  75. let warning = document.querySelector('.invalid-feedback');
  76. if(warning) {
  77. warning.style.display = 'none';
  78. }
  79. let email = document.getElementById('password');
  80. email.setAttribute('readonly', 'readonly');
  81. email.style.opacity = '20%';
  82. let trustedDevice = document.getElementById('trusted-device-wrapper');
  83. trustedDevice.style.opacity = '20%';
  84. let btn = document.getElementById('sbtn');
  85. btn.classList.add('disabled');
  86. btn.setAttribute('disabled', 'disabled');
  87. btn.innerHTML = '<div class="spinner-border spinner-border-sm" role="status"><span class="sr-only">Loading...</span></div>';
  88. document.getElementById('sudoForm').submit()
  89. }
  90. </script>
  91. @endpush