const openWindow = ({url, title, w, h}) => {
const dualScreenLeft = window.screenLeft !== undefined ? window.screenLeft : window.screenX;
const dualScreenTop = window.screenTop !== undefined ? window.screenTop : window.screenY;
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
const systemZoom = width / window.screen.availWidth;
const left = (width - w) / 2 / systemZoom + dualScreenLeft
const top = (height - h) / 2 / systemZoom + dualScreenTop
const newWindow = window.open(url, title,
`
scrollbars=yes,
width=${w / systemZoom},
height=${h / systemZoom},
top=${top},
left=${left}
`
)
if (window.focus) newWindow.focus();
}
/*** Class Function Login */
function Login(task, params){
this.task = task;
this.params = params;
switch(task) {
case 'forwardMenteePage':
forwardMenteePage();
break;
case 'forwardLoginPage':
location.href = path + "/index.php";
break;
case 'forwardRegisterPage':
location.href = path + "/register.php";
break;
/** Login */
case 'loginAct':
loginAct();
break;
case 'loginTogglePassword':
loginTogglePassword();
break;
case 'loginRoleCheck':
var rdkey = params;
$("#"+rdkey).prop("checked", true);
break;
case 'loginGoogleAct':
loginGoogleAct();
break;
/** Register */
case 'registerGoogleAct':
registerGoogleAct();
break;
case 'registerMLAct':
registerMLAct();
break;
case 'registerAct_slide1':
registerAct_slide1();
break;
case 'registerAct_slide2':
registerAct_slide2();
break;
case 'registerAct_slide3':
registerAct_slide3();
break;
case 'registerSendOtherCode':
registerSendOtherCode();
break;
case 'registerBack_home':
registerBack_home();
break;
case 'registerBack_slide1':
registerBack_slide1();
break;
case 'registerBack_slide2':
registerBack_slide2();
break;
case 'registerTogglePassword':
registerTogglePassword();
break;
case 'registerTogglePassword_confirm':
registerTogglePassword_confirm();
break;
/** Reset Passwd */
case 'resetAct_slide1':
resetAct_slide1();
break;
case 'resetAct_slide2':
resetAct_slide2();
break;
case 'resetAct_slide3':
resetAct_slide3();
break;
case 'resetSendOtherCode':
resetSendOtherCode();
break;
case 'resetBack_slide1':
resetBack_slide1();
break;
case 'resetBack_slide2':
resetBack_slide2();
break;
case 'resetTogglePassword':
resetTogglePassword();
break;
case 'resetTogglePassword_confirm':
resetTogglePassword_confirm();
break;
}
function forwardMenteePage() {
var pars = 'task=forwardMenteePage';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
location.href = response;
},
error: function(zhr){
//alert("Error!");
}
});
}
function validPassword(inputText) {
var pattern = /^(?=.*[a-z])/;
if (!inputText.match(pattern)) {
return false;
}
pattern = /^(?=.*[A-Z])/;
if (!inputText.match(pattern)) {
return false;
}
pattern = /^(.{8,})$/;
if (!inputText.match(pattern)) {
return false;
}
return true;
}
/** Login */
function validLogin(){
var form = document.frmLogin;
if (form.txtEmail.value == ""){
Swal.fire({
icon: 'warning',
text: 'Vui lòng nhập Địa chỉ Email.',
didDestroy: function () {
form.txtEmail.focus();
}
});
return false;
}
else {
var inputText = form.txtEmail.value;
inputText = $.trim(inputText);
form.txtEmail.value = inputText;
var pattern = /^[a-zA-Z0-9.!#$%&'*/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if (!inputText.match(pattern)){
Swal.fire({
icon: 'error',
text: 'Địa chỉ Email không hợp lệ!',
didDestroy: function () {
form.txtEmail.focus();
}
});
return false;
}
}
if(form.txtPassword.value == ""){
Swal.fire({
icon: 'warning',
text: 'Vui lòng nhập Mật khẩu.',
didDestroy: function () {
form.txtPassword.focus();
}
});
return false;
}
return true;
}// validLogin
function loginAct() {
if(validLogin()){
$("#lbl-register-wait").show();
$("#txtEmail").attr("readonly", true);
$("#txtPassword").attr("readonly", true);
$("#btnLogin").attr("disabled", true);
var form = document.frmLogin;
var pars = 'task=login';
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
pars += '&password=' + form.txtPassword.value;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
$("#txtEmail").attr("readonly", false);
$("#txtPassword").attr("readonly", false);
$("#btnLogin").attr("disabled", false);
var result = JSON.parse(response);
if(result["status"] == 'error'){
Swal.fire({
icon: 'error',
html: 'Email và mật khẩu không trùng khớp.
Vui lòng thử lại!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
else if (result["status"] == 'notexist') {
Swal.fire({
icon: 'warning',
html: 'Tài khoản không tồn tại.
Vui lòng nhấn nút Đăng Ký để tạo tài khoản mới!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
else if(result["status"] == 'notactive'){
Swal.fire({
icon: 'warning',
html: 'Tài khoản của bạn chưa được kích hoạt.
Vui lòng kiểm tra email!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
else if(result["status"] == 'block') {
Swal.fire({
icon: 'warning',
html: 'Tài khoản của bạn đã bị khoá.',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
else if (result["status"] == 'wrongrole') {
Swal.fire({
icon: 'error',
html: 'Sai tài khoản đăng nhập.
Vui lòng đăng nhập tài khoản Học viên!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
else if(result["status"] == 'checkrole') {
Swal.fire({
html: result["html"],
preConfirm: () => {
var role = $("input[name='rdRole']:checked").val();
if (!(role==1 || role==2)) {
Swal.showValidationMessage(
"Bạn chưa chọn vai trò."
);
}
return;
}
}).then((result) => {
if (result.isConfirmed) {
var role = $("input[name='rdRole']:checked").val();
loginAct_Role(role);
}
});
}
else if(result["status"] == 'finish') {
if (result["flagReg"] == true) {
Swal.fire({
icon: 'success',
html: 'Đăng nhập thành công.',
allowOutsideClick: false,
didDestroy: function () {
location.href = result["url"];
}
});
}
else {
location.href = result["path"];
}
}
else {
Swal.fire({
icon: 'warning',
html: 'Vui lòng Đăng Nhập lại!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}
}// loginAct
function loginAct_Role(role) {
var form = document.frmLogin;
var pars = 'task=login_role';
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
pars += '&password=' + form.txtPassword.value;
pars += '&role=' + role;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
var result = JSON.parse(response);
if(result["status"] == 'finish') {
if (result["flagReg"] == true) {
Swal.fire({
icon: 'success',
html: 'Đăng nhập thành công.',
allowOutsideClick: false,
didDestroy: function () {
location.href = result["url"];
}
});
}
else {
location.href = result["path"];
}
}
else {
Swal.fire({
icon: 'warning',
html: 'Vui lòng Đăng Nhập lại!',
didDestroy: function () {
form.txtPassword.value = "";
form.txtEmail.focus();
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}// loginAct_Role
function loginTogglePassword() {
// toggle the type attribute
var type = $('#txtPassword').attr('type') === 'password' ? 'text' : 'password';
$('#txtPassword').attr('type', type);
// toggle the eye slash icon
$('#togglePassword').toggleClass('fa-eye-slash');
}// loginTogglePassword
function loginGoogleAct() {
let googleurl = path + '/google-api/login.php';
openWindow({url: googleurl, title: 'MLGoogleWindow', w: 500, h: 550});
}
/** Register */
/*
* valid fullname
* Bỏ dấu trước khi check regex
*/
function removeAscent (str) {
if (str === null || str === undefined) return str;
str = str.toLowerCase();
str = str.replace(/à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ/g, "a");
str = str.replace(/è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ/g, "e");
str = str.replace(/ì|í|ị|ỉ|ĩ/g, "i");
str = str.replace(/ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ/g, "o");
str = str.replace(/ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ/g, "u");
str = str.replace(/ỳ|ý|ỵ|ỷ|ỹ/g, "y");
str = str.replace(/đ/g, "d");
return str;
}
function registerGoogleAct() {
let googleurl = path + '/google-api/login.php';
openWindow({url: googleurl, title: 'MLGoogleWindow', w: 500, h: 550});
}
function registerMLAct() {
$("#lbl-register-wait").show();
var pars = 'task=registerMLAct';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
var result = JSON.parse(response);
location.href = result["url"];
},
error: function(zhr){
//alert("Error!");
}
});
}
function cleanString(input) {
let trimmedStr = input.trim();
let cleanedStr = trimmedStr.replace(/\s+/g, ' ');
return cleanedStr;
}
function registerAct_slide1() {
var form = document.frmRegister;
var fullname = form.txtFullname.value;
fullname = cleanString(fullname);
form.txtFullname.value = fullname;
if (fullname == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Họ và Tên của bạn.',
didDestroy: function () {
form.txtFullname.focus();
}
});
return;
}
else {
// check fullname
var regexp = new RegExp(/^(([A-Za-z]+[\-\']?)*([A-Za-z]+)?\s)*([A-Za-z]+[\-\']?)*([A-Za-z]+)?$/);
var reg = regexp.test(removeAscent(fullname));
if (reg == false) {
Swal.fire({
icon: 'warning',
html: 'Họ và Tên của bạn không hợp lệ.',
didDestroy: function () {
form.txtFullname.focus();
}
});
return;
}
}
var phone = form.txtPhone.value;
phone = phone.trim();
form.txtPhone.value = phone;
if (phone == "") {
Swal.fire({
icon: 'warning',
text: 'Vui lòng nhập Số điện thoại.',
didDestroy: function () {
form.txtPhone.focus();
}
});
return false;
}
var email = form.txtEmail.value;
email = email.trim();
form.txtEmail.value = email;
if (form.txtEmail.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Địa chỉ Email.',
didDestroy: function () {
form.txtEmail.focus();
}
});
return;
}
else {
var inputText = form.txtEmail.value;
inputText = $.trim(inputText);
form.txtEmail.value = inputText;
var pattern = /^[a-zA-Z0-9.!#$%&'*/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if (!inputText.match(pattern)){
Swal.fire({
icon: 'error',
html: 'Địa chỉ Email không hợp lệ!',
didDestroy: function () {
form.txtEmail.focus();
}
});
return;
}
}
$("#lbl-register-wait").show();
var pars = 'task=registerAct_slide1';
pars += '&fullname=' + cleanString(form.txtFullname.value);
pars += '&phone=' + form.txtPhone.value;
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "existEmail") {
Swal.fire({
icon: 'error',
html: 'Email này đã tồn tại trong hệ thống!',
didDestroy: function () {
form.txtEmail.focus();
}
});
}
else if (result["status"] == "success") {
location.href = result["url"];
}
},
error: function(zhr){
//alert("Error!");
}
});
}// - registerAct_slide1
function registerAct_slide2() {
var form = document.frmRegister;
if (form.txtSendCode.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Mã xác minh.',
didDestroy: function () {
form.txtSendCode.focus();
}
});
return false;
}
$("#lbl-register-wait").show();
var pars = 'task=registerAct_slide2';
pars += '&usercode=' + form.txtSendCode.value;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "success") {
location.href = result["url"];
}
else {
Swal.fire({
icon: 'error',
html: 'Mã xác minh không đúng.
Vui lòng kiểm tra lại.',
didDestroy: function () {
form.txtSendCode.focus();
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerAct_slide3 () {
var form = document.frmRegister;
if (form.txtPassword.value == "") {
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Mật khẩu.',
didDestroy: function () {
form.txtPassword.focus();
}
});
return false;
}
else {
var inputText = form.txtPassword.value;
if ( !validPassword(inputText) ) {
Swal.fire({
icon: 'error',
html: 'Mật khẩu không hợp lệ!',
didDestroy: function () {
form.txtPassword.focus();
form.txtConfirmPassword.value = "";
}
});
return false;
}
}
if (form.txtConfirmPassword.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Xác nhận mật khẩu.',
didDestroy: function () {
form.txtConfirmPassword.focus();
}
});
return false;
}
if (form.txtPassword.value != form.txtConfirmPassword.value) {
Swal.fire({
icon: 'error',
html: 'Mật khẩu không trùng khớp.',
didDestroy: function () {
form.txtPassword.focus();
form.txtConfirmPassword.value = "";
}
});
return false;
}
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=registerAct_slide3_mentee';
pars += '&password=' + form.txtPassword.value;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "finish") {
Swal.fire({
icon: 'success',
html: 'Đăng ký thành công.',
allowOutsideClick: false,
didDestroy: function () {
location.href = result["path"];
}
});
}
else {
Swal.fire({
html: "Đăng ký tài khoản không thành công.
Vui lòng làm lại.",
icon: 'warning',
confirmButtonColor: '#3085d6',
confirmButtonText: ' Đóng '
}).then((result) => {
if (result.isConfirmed) {
location.href = path + "/register.php";
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerSendOtherCode() {
/** waiting load */
$("#lbl-register-wait").show();
$("#linkSendCode").removeClass( "isDisabled" );
$("#linkSendCode").addClass( "isDisabled" );
var form = document.frmRegister;
var pars = 'task=registerSendOtherCode';
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "success") {
Swal.fire({
icon: 'success',
html: 'Mã xác minh đã được MentorLinks gửi đến bạn.'
});
}
setTimeout(function (){
$("#linkSendCode").removeClass( "isDisabled" );
}, 30000);
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerBack_home() {
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=registerBack_home';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
location.href = path + "/register.php";
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerBack_slide1() {
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=registerBack_slide1';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
location.href = path + "/register.php?p=step1";
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerBack_slide2() {
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=registerBack_slide2';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
location.href = path + "/register.php?p=step2";
},
error: function(zhr){
//alert("Error!");
}
});
}
function registerTogglePassword() {
// toggle the type attribute
var type = $('#txtPassword').attr('type') === 'password' ? 'text' : 'password';
$('#txtPassword').attr('type', type);
// toggle the eye slash icon
$('#togglePassword').toggleClass('fa-eye-slash');
}
function registerTogglePassword_confirm() {
// toggle the type attribute
var type = $('#txtConfirmPassword').attr('type') === 'password' ? 'text' : 'password';
$('#txtConfirmPassword').attr('type', type);
// toggle the eye slash icon
$('#togglePassword_confirm').toggleClass('fa-eye-slash');
}
/** Reset Passwd */
function resetAct_slide1() {
var form = document.frmReset;
if (form.txtEmail.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Địa chỉ Email.',
didDestroy: function () {
form.txtEmail.focus();
}
});
return;
}
else {
var inputText = form.txtEmail.value;
inputText = $.trim(inputText);
form.txtEmail.value = inputText;
var pattern = /^[a-zA-Z0-9.!#$%&'*/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
if (!inputText.match(pattern)){
Swal.fire({
icon: 'error',
html: 'Địa chỉ Email không hợp lệ!',
didDestroy: function () {
form.txtEmail.focus();
}
});
return;
}
}
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=resetAct_slide1';
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "notExistEmail") {
Swal.fire({
icon: 'error',
html: 'Email này không tồn tại trong hệ thống!',
didDestroy: function () {
form.txtEmail.focus();
}
});
}
else if (result["status"] == "success") {
location.href = result["url"];
}
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetAct_slide2() {
var form = document.frmReset;
if (form.txtSendCode.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Mã xác minh.',
didDestroy: function () {
form.txtSendCode.focus();
}
});
return false;
}
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=resetAct_slide2';
pars += '&usercode=' + form.txtSendCode.value;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "success") {
location.href = result["url"];
}
else {
Swal.fire({
icon: 'error',
html: 'Mã xác minh không đúng.
Vui lòng kiểm tra lại.',
didDestroy: function () {
form.txtSendCode.focus();
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetAct_slide3() {
var form = document.frmReset;
if (form.txtPassword.value == "") {
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Mật khẩu.',
didDestroy: function () {
form.txtPassword.focus();
}
});
return false;
}
else {
var inputText = form.txtPassword.value;
if ( !validPassword(inputText) ) {
Swal.fire({
icon: 'error',
html: 'Mật khẩu không hợp lệ!',
didDestroy: function () {
form.txtPassword.focus();
form.txtConfirmPassword.value = "";
}
});
return false;
}
}
if (form.txtConfirmPassword.value == ""){
Swal.fire({
icon: 'warning',
html: 'Vui lòng nhập Xác nhận mật khẩu.',
didDestroy: function () {
form.txtConfirmPassword.focus();
}
});
return false;
}
if (form.txtPassword.value != form.txtConfirmPassword.value) {
Swal.fire({
icon: 'error',
html: 'Mật khẩu không trùng khớp.',
didDestroy: function () {
form.txtPassword.focus();
form.txtConfirmPassword.value = "";
}
});
return false;
}
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=resetAct_slide3_updatepasswd';
pars += '&password=' + form.txtPassword.value;
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response) {
$("#lbl-register-wait").hide();
var result = JSON.parse(response);
if (result["status"] == "success") {
Swal.fire({
html: "Đổi mật khẩu thành công.",
icon: 'success',
confirmButtonColor: '#3085d6',
confirmButtonText: ' Đóng '
}).then((result) => {
if (result.isConfirmed) {
location.href = path + "/index.php";
}
});
}
else {
Swal.fire({
html: "Đổi mật khẩu không thành công.
Vui lòng làm lại.",
icon: 'warning',
confirmButtonColor: '#3085d6',
confirmButtonText: ' Đóng '
}).then((result) => {
if (result.isConfirmed) {
location.href = path + "/reset.php";
}
});
}
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetSendOtherCode() {
/** waiting load */
$("#lbl-register-wait").show();
$("#linkSendCode").removeClass( "isDisabled" );
$("#linkSendCode").addClass( "isDisabled" );
var form = document.frmReset;
var pars = 'task=resetSendOtherCode';
pars += '&email=' + encodeURIComponent(form.txtEmail.value);
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
Swal.fire({
icon: 'success',
html: 'Mã xác minh đã được MentorLinks gửi đến bạn.'
});
setTimeout(function (){
$("#linkSendCode").removeClass( "isDisabled" );
}, 30000);
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetBack_slide1() {
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=resetBack_slide1';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
location.href = path + "/reset.php";
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetBack_slide2() {
/** waiting load */
$("#lbl-register-wait").show();
var pars = 'task=resetBack_slide2';
var url = path + '/loginAjax.php';
$.ajax({
url: url,
data: pars,
type: 'GET',
success: function(response){
$("#lbl-register-wait").hide();
location.href = path + "/reset.php?p=step2";
},
error: function(zhr){
//alert("Error!");
}
});
}
function resetTogglePassword() {
// toggle the type attribute
var type = $('#txtPassword').attr('type') === 'password' ? 'text' : 'password';
$('#txtPassword').attr('type', type);
// toggle the eye slash icon
$('#togglePassword').toggleClass('fa-eye-slash');
}
function resetTogglePassword_confirm() {
// toggle the type attribute
var type = $('#txtConfirmPassword').attr('type') === 'password' ? 'text' : 'password';
$('#txtConfirmPassword').attr('type', type);
// toggle the eye slash icon
$('#togglePassword_confirm').toggleClass('fa-eye-slash');
}
}//Login