confirm-auth-token.blade.php 2.7 KB

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