confirm-auth-token.blade.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. @extends('layouts.login')
  2. @section('content')
  3. <div id="confirmAuthTokenComponent" v-cloak>
  4. <div class="d-flex align-items-center flex-column text-center p-3">
  5. <div class="flex-grow-1 single-form-heading font-weight-medium">Confirm Token</div>
  6. </div>
  7. <form action="{{route('process-confirm-auth-token')}}" class="form" method="post">
  8. <div class="icon_wrap">
  9. <img src="{{asset('/img/login_icon.svg')}}" alt="">
  10. </div>
  11. @csrf
  12. @if(session('message'))
  13. <div class="alert alert-info">{{session('message')}}</div>
  14. @endif
  15. <div class="form-group">
  16. <div class="p-2 text-center">
  17. <strong>
  18. Please enter the code sent to {{ $maskedCellNumber }}.
  19. </strong>
  20. </div>
  21. <input class="form-control" name="confirmation_token" autocomplete="off" autofocus placeholder="" required value="{{old('confirmation_token')}}">
  22. </div>
  23. <div class="row">
  24. <div class="col-12 text-center">
  25. <input type="submit" name="sendToken" value="Confirm Token" class="btn btn-orange text-uppercase py-2 px-4">
  26. </div>
  27. </div>
  28. <div class="text-center mt-3">
  29. <div class="d-flex align-items-center flex-wrap justify-content-center">
  30. <a href="#" class="text-pry" resend-token>
  31. <span v-if="!loading">resend token</span>
  32. <span v-else><i class="fas fa-circle-notch fa-spin"></i> Resending...</span>
  33. </a>
  34. <span class="mx-2 font-weight-bold">OR</span>
  35. <a href="{{ route('login') }}" class="text-pry">change phone number</a>
  36. </div>
  37. </div>
  38. <div v-if="response" class="text-center mb-4">
  39. <small v-if="!response.success" class="text-danger"><i class="fas fa-exclamation-triangle"></i> @{{ response.message }}</small>
  40. <small v-else class="text-success"><i class="fas fa-check-circle"></i> Confirmation code has been resent!</small>
  41. </div>
  42. </form>
  43. </div>
  44. <script>
  45. var confirmAuthTokenComponent = new Vue({
  46. el: '#confirmAuthTokenComponent',
  47. data: {
  48. loading: false,
  49. response: null
  50. },
  51. delimiters: ['@[[', ']]'],
  52. methods: {
  53. initResendConfirmationToken: function() {
  54. var self = this;
  55. $('[resend-token]').click(function(evt) {
  56. evt.preventDefault();
  57. if (self.loading) return;
  58. self.loading = true;
  59. $.post("{{ route('resend-sms-auth-token') }}", {}, function(response) {
  60. self.loading = false;
  61. self.response = response;
  62. }, 'json');
  63. });
  64. },
  65. init: function() {
  66. this.initResendConfirmationToken();
  67. },
  68. },
  69. mounted: function() {
  70. this.init();
  71. // @VJK Why is this needed?
  72. $('[name=confirmation_token]').focus();
  73. }
  74. });
  75. </script>
  76. @endsection