Server IP : 150.95.80.236 / Your IP : 3.128.172.168 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/uat.pcu.in.th/demo15/src/js/custom/account/settings/ |
Upload File : |
"use strict"; // Class definition var KTAccountSettingsSigninMethods = function () { // Private functions var initSettings = function () { // UI elements var signInMainEl = document.getElementById('kt_signin_email'); var signInEditEl = document.getElementById('kt_signin_email_edit'); var passwordMainEl = document.getElementById('kt_signin_password'); var passwordEditEl = document.getElementById('kt_signin_password_edit'); // button elements var signInChangeEmail = document.getElementById('kt_signin_email_button'); var signInCancelEmail = document.getElementById('kt_signin_cancel'); var passwordChange = document.getElementById('kt_signin_password_button'); var passwordCancel = document.getElementById('kt_password_cancel'); // toggle UI signInChangeEmail.querySelector('button').addEventListener('click', function () { toggleChangeEmail(); }); signInCancelEmail.addEventListener('click', function () { toggleChangeEmail(); }); passwordChange.querySelector('button').addEventListener('click', function () { toggleChangePassword(); }); passwordCancel.addEventListener('click', function () { toggleChangePassword(); }); var toggleChangeEmail = function () { signInMainEl.classList.toggle('d-none'); signInChangeEmail.classList.toggle('d-none'); signInEditEl.classList.toggle('d-none'); } var toggleChangePassword = function () { passwordMainEl.classList.toggle('d-none'); passwordChange.classList.toggle('d-none'); passwordEditEl.classList.toggle('d-none'); } } var handleChangeEmail = function (e) { var validation; // form elements var signInForm = document.getElementById('kt_signin_change_email'); validation = FormValidation.formValidation( signInForm, { fields: { emailaddress: { validators: { notEmpty: { message: 'Email is required' }, emailAddress: { message: 'The value is not a valid email address' } } }, confirmemailpassword: { validators: { notEmpty: { message: 'Password is required' } } } }, plugins: { //Learn more: https://formvalidation.io/guide/plugins trigger: new FormValidation.plugins.Trigger(), bootstrap: new FormValidation.plugins.Bootstrap5({ rowSelector: '.fv-row' }) } } ); signInForm.querySelector('#kt_signin_submit').addEventListener('click', function (e) { e.preventDefault(); console.log('click'); validation.validate().then(function (status) { if (status == 'Valid') { swal.fire({ text: "Sent password reset. Please check your email", icon: "success", buttonsStyling: false, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn font-weight-bold btn-light-primary" } }).then(function(){ signInForm.reset(); validation.resetForm(); // Reset formvalidation --- more info: https://formvalidation.io/guide/api/reset-form/ }); } else { swal.fire({ text: "Sorry, looks like there are some errors detected, please try again.", icon: "error", buttonsStyling: false, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn font-weight-bold btn-light-primary" } }); } }); }); } var handleChangePassword = function (e) { var validation; // form elements var passwordForm = document.getElementById('kt_signin_change_password'); validation = FormValidation.formValidation( passwordForm, { fields: { currentpassword: { validators: { notEmpty: { message: 'Current Password is required' } } }, newpassword: { validators: { notEmpty: { message: 'New Password is required' } } }, confirmpassword: { validators: { notEmpty: { message: 'Confirm Password is required' }, identical: { compare: function() { return passwordForm.querySelector('[name="newpassword"]').value; }, message: 'The password and its confirm are not the same' } } }, }, plugins: { //Learn more: https://formvalidation.io/guide/plugins trigger: new FormValidation.plugins.Trigger(), bootstrap: new FormValidation.plugins.Bootstrap5({ rowSelector: '.fv-row' }) } } ); passwordForm.querySelector('#kt_password_submit').addEventListener('click', function (e) { e.preventDefault(); console.log('click'); validation.validate().then(function (status) { if (status == 'Valid') { swal.fire({ text: "Sent password reset. Please check your email", icon: "success", buttonsStyling: false, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn font-weight-bold btn-light-primary" } }).then(function(){ passwordForm.reset(); validation.resetForm(); // Reset formvalidation --- more info: https://formvalidation.io/guide/api/reset-form/ }); } else { swal.fire({ text: "Sorry, looks like there are some errors detected, please try again.", icon: "error", buttonsStyling: false, confirmButtonText: "Ok, got it!", customClass: { confirmButton: "btn font-weight-bold btn-light-primary" } }); } }); }); } // Public methods return { init: function () { initSettings(); handleChangeEmail(); handleChangePassword(); } } }(); // On document ready KTUtil.onDOMContentLoaded(function() { KTAccountSettingsSigninMethods.init(); });