/
home
/
efamember
/
domains
/
efa-member.com
/
public_html
/
main
/
jobs
/
up file
home
<?php require('header.php') ?> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" /> <style> .input-icons { width: 100%; } .input-icons i { position: absolute; } .icon { left: 75%; padding: 10px; min-width: 40px; margin-top: 0.5rem; } </style> <div class="container"> <div class="row mt-5"> <div class="col-md-12 col-sm-12"> <div class="card text-center p-3 shadow-sm bg-body-tertiary rounded"> <div class="card-body mt-5 mb-5"> <h4 class="card-text mb-3">ลืมรหัสผ่าน</h4> <form class="form" id="frm_forget" method="" action=""> <label for="" class="mb-4">ระบุอีเมลที่คุณใช้สมัครสมาชิก ระบบจะส่งลิงก์ไปยังอีเมลเพื่อให้คุณตั้งรหัสผ่านใหม่</label> <input class="form-control-lg w-75 border border-bottom border-left shadow-sm" id="email" type="text" placeholder="Email" onchange="Checkemail($(this));"> </form> <div class="mt-5"> <button class="btn btn-gold w-50 shadow-sm" id="forgotBtn" onclick="send_request();" disabled>ยืนยัน</button> </div> </div> </div> </div> </div> </div> <?php require('footer.php') ?> <script> function Checkemail(attr) { var Email = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/; if (!attr.val().match(Email)) { swal({ title: "คำเตือน", text: "รูปแบบ Email ไม่ถูกต้อง", type: "warning", }); attr.val(''); return false; } else { $("#forgotBtn").attr('disabled', true); let check_mail = attr.val(); $.ajax({ data: { check_mail: check_mail }, dataType: "json", type: "POST", url: "../ajax/forget_password/check_mail.php", success: function(response) { if (response.result == '1') { $('#forgotBtn').prop('disabled', false) console.log('SSR'); } else if (response.result == '0') { swal({ title: "คำเตือน", text: "ไม่พบ Email นี้ในระบบ", type: "warning", }); attr.val('') } } }); } } function send_request() { let email = $("#email").val(); $.ajax({ type: "POST", url: "../ajax/forget_password/send_mail.php", data: { email: email }, dataType: "json", beforeSend: function() { swal({ title: "กำลังทำการบันทึก", text: "กรุณารอสักครู่", imageUrl: "ajax-loader.gif", showConfirmButton: false, allowOutsideClick: false }); }, error: function(data) { // console.log("error : " + data.responseText); swal({ title: "เกิดข้อผิดพลาด", text: "ไม่สามารถบันทึกรายการได้ กรุณาแจ้งทีมงาน", type: "error", }); }, success: function(data) { if (data.result == 1) { swal({ title: 'คำขอถูกส่งไปยัง email แล้ว กรุณาทำรายการภายใน 15 นาที', type: 'success', showConfirmButton: false, timer: 2000 }, function() { location.reload(); }) } } }); } </script>