Edit File: reset.blade.php
@extends('layouts.store_dashboard_un_authed_layout') @section('title') {{Session::has('lang')&&Session::get('lang')=='en'?'Reset password':' استعادة كلمة المرور '}} @endsection @section('content') <!-- start page content --> <div class="page-content"> <div class="mt-4 mb-3 text-center"> <h5 class="bold">{{trans('stores_dashboard.restore')}}</h5> <p class="m-3"> {{trans('stores_dashboard.forget_rule')}}</p> </div> <div class="w-md-50 m-auto round10 p-3 form-cont" > <form id="resetForm" class="container "> @csrf <h6 class="bold border-bottom pt-3 pb-3 mb-4">{{trans('stores_dashboard.restore')}}</h6> <div class="form-group"> <div style="direction: ltr;" class="row justify-content-center"> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> <div class="pt-1 d-inline-block code-input pb-1 pl-0 pr-2"> <input name='code[]' class='code-input form-control code' required/> </div> </div> </div> <div class="font12 text-center"> <p> {{awtTrans(' لم تستلم الكود؟ ')}} <a class="resend" href="#"> {{awtTrans(' إعادة الارسال ')}} </a></p> </div> <div class="form-group"> <label class="bold font14" for="Password1"> {{trans('stores_dashboard.password')}} </label> <div class="password-cont"> <input name="password" type="password" class="form-control" id="Password1" aria-describedby="emailHelp" placeholder="{{trans('stores_dashboard.password')}}"> <i class="fa fa-eye color-gray" id="signInShowPassword1"></i> </div> </div> <div class="form-group"> <label class="bold font14" for="Password1">{{trans('stores_dashboard.password_confirm')}} </label> <div class="password-cont"> <input name="password_confirmation" type="password" class="form-control" id="Password2" aria-describedby="emailHelp" placeholder="{{trans('stores_dashboard.password')}}"> <i class="fa fa-eye color-gray" id="signInShowPassword2"></i> </div> </div> <button id="resetbtn" type="submit" class="button1 w-100 mt-3 material-button" > {{trans('stores_dashboard.confirm')}}</button> </form> </div> </div> <!-- end page content --> @endsection @section('scripts') <script> const inputElements = [...document.querySelectorAll('input.code-input')] inputElements.forEach((ele,index)=>{ ele.addEventListener('keydown',(e)=>{ if(e.keyCode === 8 && e.target.value==='') inputElements[Math.max(0,index-1)].focus() }) ele.addEventListener('input',(e)=>{ const [first,...rest] = e.target.value e.target.value = first ?? '' if(index!==inputElements.length-1 && first!==undefined) { inputElements[index+1].focus() inputElements[index+1].value = rest.join('') inputElements[index+1].dispatchEvent(new Event('input')) } }) }) function onSubmit(e){ e.preventDefault() const code = [...document.getElementsByTagName('input')] .filter(({name})=>name) .map(({value})=>value) .join('') console.log(code) } </script> <script> $("#resetbtn").on('click',function(e){ e.preventDefault(); var form = $('#resetForm').get(0); var formData = new FormData(form); var oldText = $(this).text(); $(this).prop('disabled', true).css({ opacity:'0.5' }).text("{{trans('stores_dashboard.loading')}}"); $.ajax({ url:"{{route('stores_dashboard.post_reset_password')}}", type:"POST", data: formData, dataType: "json", processData: false, contentType: false, cache: false, success:function(data){ $('#resetbtn').removeAttr("disabled").css({ opacity:'1' }).text(oldText); if(data.key =='success'){ Swal.fire({ title: data.msg, position:'top', timer: 15000, type:'success', showCloseButton: false, showConfirmButton:false, animation: true }) location.assign(data.url); }else{ Swal.fire({ title: data.msg, position:'top', timer: 3000, type:'error', showCloseButton: false, showConfirmButton:false, animation: true }) } } }); }); </script> <script> $('.resend').on('click',function(e){ e.preventDefault(); $.ajax({ url:"{{route('stores_dashboard.reset_code_again')}}", type:"GET", dataType: "json", processData: false, contentType: false, cache: false, success:function(data){ if(data.key =='success') { swal.fire({ title: data.msg, position:'top', timer: 3000, type:'success', showCloseButton: false, showConfirmButton:false, animation: true }) location.assign(data.location); }else{ swal.fire({ title: data.msg, position:'top', timer: 3000, type:'error', showCloseButton: false, showConfirmButton:false, animation: true }) } } }); }); </script> @endsection
Back to File Manager