1API_PATH = '/API/' 2LOGIN_THEN_SAVE = false; 3$('.reg_button').click(function (){ 4 $('.login_error').hide() 5 $('.reg_error').hide() 6 7 var is_valid = true; 8 let email = $('.regi_email input').val() 9 let pass = $('.regi_pass input').val() 10 11 if (!validateEmail(email)){ 12 $('.reg_email_error').show() 13 is_valid = false 14 } 15 16 if (pass.length < 6){ 17 $('.reg_pass_error').show() 18 $('.reg_pass_error').html('At least 6 characters') 19 is_valid = false 20 } 21 22 if (is_valid){ 23 submit_register(email,pass) 24 } 25 26 27}) 28 29function submit_register(email,pass){ 30 let data = { 31 action:'register', 32 email:email, 33 pass:pass 34 } 35 $.post(API_PATH + 'login.php',data,function(res){ 36 var res_json = JSON.parse(res) 37 console.log(res_json) 38 if (res_json.msg == 'Email already taken'){ 39 $('.reg_error').html('Email already taken') 40 $('.reg_error').show() 41 } else if(res_json.msg == 'Account Created'){ 42 proccess_login(email,res_json.token,res_json.stat) 43 } else { 44 $('.reg_error').html('Error Creating Account') 45 $('.reg_error').show() 46 $('.login_button_pressed').removeClass('login_button_pressed') 47 } 48 }) 49} 50 51 52USER = {}; 53USER.logedin = false; 54USER.email = ''; 55USER.refferer = ''; 56 57USER.token = getCookie('token') 58if (USER.token != ''){ 59 USER.logedin = true; 60 USER.email = getCookie('email') 61} 62 63 64 65 66function proccess_login(email,token,stat,gen){ 67 USER.logedin = true; 68 USER.email = email; 69 USER.token = token; 70 USER.stat = stat; 71 USER.gen = gen; 72 73 $('body').addClass('gen_'+gen) 74 75 if (typeof(LOGIN_THEN_DOWNLOAD) == 'undefined'){ 76 LOGIN_THEN_DOWNLOAD = false 77 } 78 79 document.cookie = 'email='+email+'; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/'; 80 document.cookie = 'token='+token+'; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/'; 81 document.cookie = 'stat='+stat+'; expires=Thu, 18 Dec 2030 12:00:00 UTC; path=/'; 82 if (USER.refferer == ''){ 83 if (LOGIN_THEN_SAVE){ 84 $('.te_login_btn').hide() 85 $('.te_logout_btn').show() 86 if (is_BAP){ 87 account_page_hide('login'); 88 sidebar_block_show('save') 89 } else { 90 account_page_hide('demos'); 91 save_btn_clicked() 92 } 93 LOGIN_THEN_SAVE = false; 94 } else if (LOGIN_THEN_DOWNLOAD){ 95 $('.te_login_btn').hide() 96 $('.te_logout_btn').show() 97 show_download_page() 98 LOGIN_THEN_DOWNLOAD = false 99 } else if (typeof(IS_PRE_PAYMENT) != 'undefined'){ 100 $('.checkout_login').hide() 101 $('.checkout_payment_buttons').show() 102 $('.field-wrapper').removeClass('login') 103 $('.provided_email').html(USER.email) 104 } else { 105 window.location.replace("/account/my-themes"); 106 } 107 108 } 109 110} 111 112function validateEmail(email){ 113 return String(email) 114 .toLowerCase() 115 .match( 116 /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/ 117 ); 118}; 119 120 121$('.already_have_account').click(function (){ 122 $('.register_box').hide() 123 $('.login_box').show() 124}) 125$('.do_not_have_account').click(function (){ 126 $('.register_box').show() 127 $('.login_box').hide() 128}) 129 130 131$('.login_button').click(function (){ 132 let email = $('.login_email input').val() 133 let pass = $('.login_pass input').val() 134 submit_login(email,pass) 135}) 136 137 138function submit_login(email,pass){ 139 console.log('loginbtn') 140 $('.login_error').hide() 141 142 let data = { 143 action:'login', 144 email:email, 145 pass:pass 146 } 147 $.post(API_PATH + 'login.php',data,function(res){ 148 var res_json = JSON.parse(res) 149 if (res_json.msg == 'Login successfully'){ 150 proccess_login(email,res_json.token,res_json.stat,res_json.gen) 151 } else { 152 $('.login_error').show() 153 $('.login_error').html('Invalid Login Details') 154 $('.login_button').removeClass('login_button_pressed') 155 } 156 }) 157} 158 159 160$('.te_logout_btn').click(function (){ 161 USER.logedin = false; 162 document.cookie = 'email=; Max-Age=0; path=/'; 163 document.cookie = 'token=; Max-Age=0; path=/'; 164 document.cookie = 'stat=; Max-Age=0; path=/'; 165 window.location.replace("/themes/kyoto"); 166}) 167 168 169$('.show_forgot_password').click(function (){ 170 $('.forgot_box1').show() 171 $('.login_box').hide() 172}) 173
174$('.recover_pass_button').click(function (){ 175 request_recovery($('.recovery_email input').val()) 176}) 177 178function request_recovery(email){ 179 $('.forgot_box1').html('<div class="new_pass_confirm">Check your email</div>') 180 181 let data = { 182 action:'recover', 183 email:email 184 } 185 $.post(API_PATH + 'login.php',data,function(res){ 186 187 }) 188} 189 190console.log('login.js') 191$('.te_login_btn').click(function(){ 192 193 login_btn_clicked() 194 sidebar_item_set_active($(this)) 195}); 196function login_btn_clicked(){ 197 $('.login_wrap').removeClass('hide-true').removeClass('show-true') 198 $('.login_wrap').hide() 199 $('.login_box').show() 200 $('.r2_sidebar').addClass('with_account_page') 201 202 account_page_show('login') 203} 204 205 206$('.recover_create_new_pass').click(function (){ 207 let urlParams = new URLSearchParams(window.location.search); 208 let email = urlParams.get('email') 209 let token = urlParams.get('token') 210 create_new_password(email,token) 211}) 212function create_new_password(email,token){ 213 $('.login_error').hide() 214 215 var is_valid = true; 216 var new_pass = $('.new_pass input').val() 217 var new_pass_confirm = $('.new_pass_confirm input').val() 218 219 220 if (new_pass.length < 6){ 221 $('.new_pass_error').show() 222 $('.new_pass_error').html('At least 6 characters') 223 is_valid = false 224 } 225 226 if (new_pass != new_pass_confirm){ 227 $('.new_pass_confirm_error').show() 228 $('.new_pass_confirm_error').html('Passwords do not match') 229 is_valid = false 230 } 231 232 233 if (is_valid){ 234 let data = { 235 action:'new password', 236 email:email, 237 new_pass:new_pass, 238 token:token 239 } 240 $.post(API_PATH + 'login.php',data,function(res){ 241 $('.forgot_box_create').html('<div class="new_pass_confirm">You have successfully reset your password</div>') 242 setTimeout(function (){ 243 window.location.replace("account/login"); 244 },4000) 245 }) 246 } 247 248 249} 250 251function getCookie(cname) { 252 let name = cname + "="; 253 let decodedCookie = decodeURIComponent(document.cookie); 254 let ca = decodedCookie.split(';'); 255 for(let i = 0; i <ca.length; i++) { 256 let c = ca[i]; 257 while (c.charAt(0) == ' ') { 258 c = c.substring(1); 259 } 260 if (c.indexOf(name) == 0) { 261 return c.substring(name.length, c.length); 262 } 263 } 264 return ""; 265 } 266 267 268 269 $('.login_page .account_close_btn').click(function(){ 270 if (window.location.href.includes('/account/login')){ 271 window.location.href = '/' 272 return; 273 } 274 let block_name = $(this).closest('.account_page').data('block-name') 275 account_page_hide(block_name) 276 277 278 });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.