| @@ -1,388 +1 @@ | ||
| 1 | -jQuery(document).ready(function ($) { | |
| 2 | - | |
| 3 | - // Get cookie duration. | |
| 4 | - function getDurationBySettings() { | |
| 5 | - switch (ps_ajax.cookie_duration_unit) { | |
| 6 | - case 'days': | |
| 7 | - return parseInt(ps_ajax.cookie_duration); | |
| 8 | - break; | |
| 9 | - case 'hours': | |
| 10 | - return new Date(new Date().getTime() + (ps_ajax.cookie_duration * 10) * 60 * 1000); | |
| 11 | - break; | |
| 12 | - case 'minutes': | |
| 13 | - return new Date(new Date().getTime() + ps_ajax.cookie_duration * 60 * 1000); | |
| 14 | - break; | |
| 15 | - default: | |
| 16 | - return parseInt(ps_ajax.cookie_duration); | |
| 17 | - } | |
| 18 | - } | |
| 19 | - | |
| 20 | - // Get cache busting URL. | |
| 21 | - function getCacheFriendlyURL() { | |
| 22 | - if (location.search) { | |
| 23 | - return (location.origin).concat(location.pathname).concat(location.hash) + location.search + '&pts=' + Math.floor(Date.now() / 1000); | |
| 24 | - } else { | |
| 25 | - return (location.origin).concat(location.pathname).concat(location.hash) + '?pts=' + Math.floor(Date.now() / 1000); | |
| 26 | - } | |
| 27 | - } | |
| 28 | - | |
| 29 | - // Get hashed cookie via Ajax. | |
| 30 | - function setHashedCookie(password) { | |
| 31 | - $.ajax({ | |
| 32 | - type: "post", dataType: "json", url: ps_ajax.ajax_url, data: { | |
| 33 | - 'action': 'hash_password', 'hash_nonce': ps_ajax.hash_nonce, 'password': password, | |
| 34 | - }, success: function (response) { | |
| 35 | - Cookies.set('passster', response.password, { | |
| 36 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 37 | - }); | |
| 38 | - }, async: false, | |
| 39 | - }); | |
| 40 | - } | |
| 41 | - | |
| 42 | - // Check if we have an unlock link. | |
| 43 | - if (ps_ajax.link_pass) { | |
| 44 | - if (!ps_ajax.disable_cookie) { | |
| 45 | - if (ps_ajax.link_pass.length < 25) { | |
| 46 | - // It's an old base64 encryption. | |
| 47 | - setHashedCookie(atob(ps_ajax.link_pass)); | |
| 48 | - } else { | |
| 49 | - Cookies.set('passster', ps_ajax.link_pass, { | |
| 50 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 51 | - }); | |
| 52 | - } | |
| 53 | - | |
| 54 | - // Handle the redirect with cache busting. | |
| 55 | - window.location.replace(ps_ajax.permalink + '?pts=' + Math.floor(Date.now() / 1000)); | |
| 56 | - } | |
| 57 | - } | |
| 58 | - | |
| 59 | - // Passwords | |
| 60 | - $('.passster-submit').on('click', function (e) { | |
| 61 | - e.preventDefault(); | |
| 62 | - | |
| 63 | - // Validate form before submitting ajax. | |
| 64 | - var form = $(this).parent().parent(); | |
| 65 | - | |
| 66 | - if (!$(form)[0].checkValidity()) { | |
| 67 | - $(form)[0].reportValidity(); | |
| 68 | - } | |
| 69 | - | |
| 70 | - ps_id = $(this).attr('data-psid'); | |
| 71 | - form = $("#" + ps_id); | |
| 72 | - password = $("#" + ps_id + ' .passster-password').attr('data-password'); | |
| 73 | - type = $("#" + ps_id + ' .passster-password').attr('data-protection-type'); | |
| 74 | - list = $("#" + ps_id + ' .passster-password').attr('data-list'); | |
| 75 | - lists = $("#" + ps_id + ' .passster-password').attr('data-lists'); | |
| 76 | - area = $("#" + ps_id + ' .passster-password').attr('data-area'); | |
| 77 | - protection = $("#" + ps_id + ' .passster-password').attr('data-protection'); | |
| 78 | - redirect = $(this).attr('data-redirect'); | |
| 79 | - input = $("#" + ps_id + ' .passster-password').val(); | |
| 80 | - acf = $(this).attr('data-acf'); | |
| 81 | - | |
| 82 | - $.ajax({ | |
| 83 | - type: "post", dataType: "json", url: ps_ajax.ajax_url, data: { | |
| 84 | - 'action': 'validate_input', | |
| 85 | - 'nonce': ps_ajax.nonce, | |
| 86 | - 'input': input, | |
| 87 | - 'password': password, | |
| 88 | - 'post_id': ps_ajax.post_id, | |
| 89 | - 'type': type, | |
| 90 | - 'list': list, | |
| 91 | - 'lists': lists, | |
| 92 | - 'area': area, | |
| 93 | - 'protection': protection, | |
| 94 | - 'acf': acf, | |
| 95 | - 'redirect': redirect | |
| 96 | - }, beforeSend: function () { | |
| 97 | - form.find(".ps-loader").css('display', 'block'); | |
| 98 | - }, success: function (response) { | |
| 99 | - form.find(".ps-loader").css('display', 'none'); | |
| 100 | - if (true === response.success) { | |
| 101 | - // if no ajax. | |
| 102 | - if (!ps_ajax.unlock_mode) { | |
| 103 | - setHashedCookie(input); | |
| 104 | - | |
| 105 | - if (response.redirect) { | |
| 106 | - window.location.replace(redirect); | |
| 107 | - } else { | |
| 108 | - window.location.href = getCacheFriendlyURL(); | |
| 109 | - } | |
| 110 | - } else { | |
| 111 | - | |
| 112 | - // set cookie if activated. | |
| 113 | - if (!ps_ajax.disable_cookie) { | |
| 114 | - setHashedCookie(input); | |
| 115 | - } | |
| 116 | - form.find('.passster-error').hide(); | |
| 117 | - | |
| 118 | - // replace shortcodes. | |
| 119 | - let content = response.content; | |
| 120 | - | |
| 121 | - if (content) { | |
| 122 | - $.each(ps_ajax.shortcodes, function (key, value) { | |
| 123 | - content = content.replace(key, value); | |
| 124 | - }); | |
| 125 | - | |
| 126 | - $("#" + ps_id).replaceWith(content); | |
| 127 | - } | |
| 128 | - | |
| 129 | - // Redirect? | |
| 130 | - if (response.redirect) { | |
| 131 | - window.location.replace(redirect); | |
| 132 | - } | |
| 133 | - | |
| 134 | - } | |
| 135 | - } else { | |
| 136 | - form.find('.passster-error').text(response.error); | |
| 137 | - form.find('.passster-error').show().fadeOut(3500); | |
| 138 | - $("#" + ps_id + ' .passster-password').val(''); | |
| 139 | - } | |
| 140 | - } | |
| 141 | - }); | |
| 142 | - }); | |
| 143 | - | |
| 144 | - // Recaptcha v2 | |
| 145 | - if ($('.recaptcha-form-v2').length > 0) { | |
| 146 | - grecaptcha.ready(function () { | |
| 147 | - grecaptcha.render('ps-recaptcha-v2', { | |
| 148 | - 'sitekey': ps_ajax.recaptcha_key, 'callback': function (token) { | |
| 149 | - ps_id = $('.recaptcha-v2-submit').attr('data-psid'); | |
| 150 | - form = $("#" + ps_id); | |
| 151 | - protection = $('.recaptcha-v2-submit').attr('data-protection'); | |
| 152 | - acf = $('.recaptcha-v2-submit').attr('data-acf'); | |
| 153 | - area = $("#" + ps_id).find('.recaptcha-v2-submit').attr('data-area'); | |
| 154 | - redirect = $("#" + ps_id).find('.recaptcha-v2-submit').attr('data-redirect'); | |
| 155 | - | |
| 156 | - $.ajax({ | |
| 157 | - type: "post", dataType: "json", url: ps_ajax.ajax_url, data: { | |
| 158 | - 'action': 'validate_input', | |
| 159 | - 'nonce': ps_ajax.nonce, | |
| 160 | - 'token': token, | |
| 161 | - 'post_id': ps_ajax.post_id, | |
| 162 | - 'type': 'recaptcha', | |
| 163 | - 'protection': protection, | |
| 164 | - 'captcha_id': ps_id, | |
| 165 | - 'acf': acf, | |
| 166 | - 'area': area, | |
| 167 | - 'redirect': redirect | |
| 168 | - }, success: function (response) { | |
| 169 | - if (true === response.success) { | |
| 170 | - | |
| 171 | - // if no ajax. | |
| 172 | - if (!ps_ajax.unlock_mode) { | |
| 173 | - Cookies.set('passster', 'recaptcha', { | |
| 174 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 175 | - }); | |
| 176 | - | |
| 177 | - if (response.redirect) { | |
| 178 | - window.location.replace(redirect); | |
| 179 | - } else { | |
| 180 | - window.location.href = getCacheFriendlyURL(); | |
| 181 | - } | |
| 182 | - } else { | |
| 183 | - // set cookie if activated. | |
| 184 | - if (!ps_ajax.disable_cookie) { | |
| 185 | - Cookies.set('passster', 'recaptcha', { | |
| 186 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 187 | - }); | |
| 188 | - } | |
| 189 | - form.find('.passster-error').hide(); | |
| 190 | - | |
| 191 | - // replace shortcodes. | |
| 192 | - let content = response.content; | |
| 193 | - | |
| 194 | - if (content) { | |
| 195 | - | |
| 196 | - $.each(ps_ajax.shortcodes, function (key, value) { | |
| 197 | - content = content.replace(key, value); | |
| 198 | - }); | |
| 199 | - | |
| 200 | - $("#" + ps_id).replaceWith(content); | |
| 201 | - } | |
| 202 | - | |
| 203 | - // Redirect? | |
| 204 | - if (response.redirect) { | |
| 205 | - window.location.replace(redirect); | |
| 206 | - } | |
| 207 | - } | |
| 208 | - } else { | |
| 209 | - form.find('.passster-error').text(response.error); | |
| 210 | - form.find('.passster-error').show().fadeOut(3500); | |
| 211 | - } | |
| 212 | - } | |
| 213 | - }); | |
| 214 | - } | |
| 215 | - }); | |
| 216 | - }); | |
| 217 | - } | |
| 218 | - | |
| 219 | - // ReCaptcha v3 | |
| 220 | - $('.recaptcha-form').on('submit', function (event) { | |
| 221 | - event.preventDefault(); | |
| 222 | - | |
| 223 | - ps_id = $(this).find('.passster-submit-recaptcha').attr('data-psid'); | |
| 224 | - form = $("#" + ps_id); | |
| 225 | - protection = $(this).find('.passster-submit-recaptcha').attr('data-protection'); | |
| 226 | - acf = $(this).find('.passster-submit-recaptcha').attr('data-acf'); | |
| 227 | - area = $(this).find('.passster-submit-recaptcha').attr('data-area'); | |
| 228 | - redirect = $(this).find('.passster-submit-recaptcha').attr('data-redirect'); | |
| 229 | - | |
| 230 | - grecaptcha.ready(function () { | |
| 231 | - grecaptcha.execute(ps_ajax.recaptcha_key, {action: 'validate_input'}).then(function (token) { | |
| 232 | - | |
| 233 | - form.prepend('<input type="hidden" name="token" value="' + token + '">'); | |
| 234 | - form.prepend('<input type="hidden" name="action" value="validate_input">'); | |
| 235 | - | |
| 236 | - $.ajax({ | |
| 237 | - type: "post", dataType: "json", url: ps_ajax.ajax_url, data: { | |
| 238 | - 'action': 'validate_input', | |
| 239 | - 'nonce': ps_ajax.nonce, | |
| 240 | - 'token': token, | |
| 241 | - 'post_id': ps_ajax.post_id, | |
| 242 | - 'type': 'recaptcha', | |
| 243 | - 'protection': protection, | |
| 244 | - 'captcha_id': ps_id, | |
| 245 | - 'acf': acf, | |
| 246 | - 'area': area, | |
| 247 | - 'redirect': redirect | |
| 248 | - }, success: function (response) { | |
| 249 | - if (true === response.success) { | |
| 250 | - | |
| 251 | - // if no ajax. | |
| 252 | - if (!ps_ajax.unlock_mode) { | |
| 253 | - Cookies.set('passster', 'recaptcha', { | |
| 254 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 255 | - }); | |
| 256 | - | |
| 257 | - if (response.redirect) { | |
| 258 | - window.location.replace(redirect); | |
| 259 | - } else { | |
| 260 | - window.location.href = getCacheFriendlyURL(); | |
| 261 | - } | |
| 262 | - } else { | |
| 263 | - // set cookie if activated. | |
| 264 | - if (!ps_ajax.disable_cookie) { | |
| 265 | - Cookies.set('passster', 'recaptcha', { | |
| 266 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 267 | - }); | |
| 268 | - } | |
| 269 | - form.find('.passster-error').hide(); | |
| 270 | - // replace shortcodes. | |
| 271 | - let content = response.content; | |
| 272 | - | |
| 273 | - if (content) { | |
| 274 | - $.each(ps_ajax.shortcodes, function (key, value) { | |
| 275 | - content = content.replace(key, value); | |
| 276 | - }); | |
| 277 | - | |
| 278 | - form.replaceWith(content); | |
| 279 | - } | |
| 280 | - | |
| 281 | - // Redirect? | |
| 282 | - if (response.redirect) { | |
| 283 | - window.location.replace(redirect); | |
| 284 | - } | |
| 285 | - } | |
| 286 | - } else { | |
| 287 | - form.find('.passster-error').text(response.error); | |
| 288 | - form.find('.passster-error').show().fadeOut(3500); | |
| 289 | - } | |
| 290 | - } | |
| 291 | - }); | |
| 292 | - }); | |
| 293 | - }); | |
| 294 | - }); | |
| 295 | - | |
| 296 | - // hcaptcha | |
| 297 | - $('.hcaptcha-form').on('submit', function (event) { | |
| 298 | - event.preventDefault(); | |
| 299 | - | |
| 300 | - ps_id = $(this).find('.passster-submit-recaptcha').attr('data-psid'); | |
| 301 | - form = $("#" + ps_id); | |
| 302 | - protection = $(this).find('.passster-submit-recaptcha').attr('data-protection'); | |
| 303 | - acf = $(this).find('.passster-submit-recaptcha').attr('data-acf'); | |
| 304 | - area = $(this).find('.passster-submit-recaptcha').attr('data-area'); | |
| 305 | - redirect = $(this).find('.passster-submit-recaptcha').attr('data-redirect'); | |
| 306 | - | |
| 307 | - hcaptcha.execute({async: true}) | |
| 308 | - .then(({response, key}) => { | |
| 309 | - $.ajax({ | |
| 310 | - type: "post", dataType: "json", url: ps_ajax.ajax_url, data: { | |
| 311 | - 'action': 'validate_input', | |
| 312 | - 'nonce': ps_ajax.nonce, | |
| 313 | - 'token': response, | |
| 314 | - 'post_id': ps_ajax.post_id, | |
| 315 | - 'type': 'recaptcha', | |
| 316 | - 'protection': protection, | |
| 317 | - 'captcha_id': ps_id, | |
| 318 | - 'acf': acf, | |
| 319 | - 'area': area, | |
| 320 | - 'redirect': redirect | |
| 321 | - }, success: function (response) { | |
| 322 | - if (true === response.success) { | |
| 323 | - | |
| 324 | - // if no ajax. | |
| 325 | - if (!ps_ajax.unlock_mode) { | |
| 326 | - Cookies.set('passster', 'recaptcha', { | |
| 327 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 328 | - }); | |
| 329 | - | |
| 330 | - if (response.redirect) { | |
| 331 | - window.location.replace(redirect); | |
| 332 | - } else { | |
| 333 | - window.location.href = getCacheFriendlyURL(); | |
| 334 | - } | |
| 335 | - } else { | |
| 336 | - // set cookie if activated. | |
| 337 | - if (!ps_ajax.disable_cookie) { | |
| 338 | - Cookies.set('passster', 'recaptcha', { | |
| 339 | - expires: getDurationBySettings(), sameSite: 'strict' | |
| 340 | - }); | |
| 341 | - } | |
| 342 | - form.find('.passster-error').hide(); | |
| 343 | - // replace shortcodes. | |
| 344 | - let content = response.content; | |
| 345 | - | |
| 346 | - if (content) { | |
| 347 | - $.each(ps_ajax.shortcodes, function (key, value) { | |
| 348 | - content = content.replace(key, value); | |
| 349 | - }); | |
| 350 | - | |
| 351 | - form.replaceWith(content); | |
| 352 | - } | |
| 353 | - | |
| 354 | - // Redirect? | |
| 355 | - if (response.redirect) { | |
| 356 | - window.location.replace(redirect); | |
| 357 | - } | |
| 358 | - } | |
| 359 | - } else { | |
| 360 | - form.find('.passster-error').text(response.error); | |
| 361 | - form.find('.passster-error').show().fadeOut(3500); | |
| 362 | - } | |
| 363 | - } | |
| 364 | - }); | |
| 365 | - }) | |
| 366 | - .catch(err => { | |
| 367 | - form.find('.passster-error').text(err); | |
| 368 | - form.find('.passster-error').show().fadeOut(3500); | |
| 369 | - }); | |
| 370 | - | |
| 371 | - }); | |
| 372 | - | |
| 373 | - // Concurrent logout. | |
| 374 | - $(document).on('click', '#ps-logout', function () { | |
| 375 | - $.ajax({ | |
| 376 | - type: 'post', | |
| 377 | - dataType: 'json', | |
| 378 | - url: ps_ajax.ajax_url, | |
| 379 | - data: {'action': 'handle_logout', 'logout_nonce': ps_ajax.logout_nonce}, | |
| 380 | - success: function (response) { | |
| 381 | - if (true === response.success) { | |
| 382 | - Cookies.set('passster', '', {expires: 0, sameSite: 'strict'}); | |
| 383 | - window.location.href = getCacheFriendlyURL(); | |
| 384 | - } | |
| 385 | - } | |
| 386 | - }); | |
| 387 | - }); | |
| 388 | -}); | |
| 1 | +jQuery(document).ready(function(t){const a=ps_ajax.rest_url+"passster/v1";function e(){switch(ps_ajax.cookie_duration_unit){case"days":default:return parseInt(ps_ajax.cookie_duration);case"hours":return new Date((new Date).getTime()+60*ps_ajax.cookie_duration*60*1e3);case"minutes":return new Date((new Date).getTime()+60*ps_ajax.cookie_duration*1e3)}}function s(){const t="pts="+Math.floor(Date.now()/1e3);return location.origin+location.pathname+(location.search?location.search+"&"+t:"?"+t)+(location.hash||"")}function r(){const t=Cookies.get("passster");return t?t.split("|").filter(t=>t.length>0):[]}function n(a,e,r){if(a.redirect)window.location.replace(a.redirect);else if(ps_ajax.unlock_mode){if(e.find(".passster-error").hide(),a.requires_reload)return void(window.location.href=s());if(a.content){let s=a.content;ps_ajax.shortcodes&&t.each(ps_ajax.shortcodes,function(t,a){s=s.replace(t,a)}),e.replaceWith(s)}r&&window.location.replace(r)}else window.location.href=s()}function i(t,a){const e=t.find(".passster-error");e.text(a||"An error occurred."),e.show().fadeOut(3500)}async function o(t,e,s,r,o,c,p){try{const r=await fetch(a+"/captcha",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:t,type:e,post_id:ps_ajax.post_id,area_id:o,redirect:c,protection:p||""})}),d=await r.json();d.success?n(d,s,c):i(s,d.error)}catch(t){i(s,"Captcha validation failed.")}}ps_ajax.link_pass&&(ps_ajax.disable_cookie||(ps_ajax.link_pass.length<25?async function(t,s){const n=await async function(t,e){try{const s=await fetch(a+"/hash",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:t,post_id:e})});return(await s.json()).hash||""}catch(t){return""}}(t,s);if(n){const t=r();t.includes(n)||t.push(n),Cookies.set("passster",t.join("|"),{expires:e(),sameSite:"strict"})}}(atob(ps_ajax.link_pass),ps_ajax.post_id).then(()=>{window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))}):(!function(t){const a=r();a.includes(t)||a.push(t),Cookies.set("passster",a.join("|"),{expires:e(),sameSite:"strict"})}(ps_ajax.link_pass),window.location.replace(ps_ajax.permalink+"?pts="+Math.floor(Date.now()/1e3))))),t(".passster-submit").on("click",async function(e){e.preventDefault();const s=t(this),r=s.attr("data-psid"),o=t("#"+r),c=o.find(".passster-password"),p=parseInt(s.attr("data-post-id"))||ps_ajax.post_id,d=o.find("form")[0];if(d&&!d.checkValidity())return void d.reportValidity();const l=c.val(),h=(c.attr("data-protection-type")||"password").replace(/-/g,"_"),u=parseInt(c.attr("data-area"))||0,f=parseInt(c.attr("data-list"))||0,_=c.attr("data-lists")||"",w=c.attr("data-protection")||"",y=s.attr("data-acf")||"",m=s.attr("data-redirect")||"",j=parseInt(s.attr("data-term-id"))||0,k=s.attr("data-post-type")||"",g=o.closest(".passster-protected-content"),x=g.length?g.attr("data-block-id"):"";o.find(".ps-loader").css("display","block");try{const t=await fetch(a+"/unlock",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({password:l,type:h,post_id:p,area_id:u,block_id:x,list_id:f,lists:_,protection:w,acf:y,redirect:m,term_id:j,post_type:k})}),e=await t.json();o.find(".ps-loader").css("display","none"),e.success?n(e,o,m):(i(o,e.error),c.val(""))}catch(t){o.find(".ps-loader").css("display","none"),i(o,"An error occurred. Please try again.")}}),t(".recaptcha-form-v2").length>0&&window.grecaptcha&&grecaptcha.ready(function(){grecaptcha.render("ps-recaptcha-v2",{sitekey:ps_ajax.recaptcha_key,callback(a){const e=t(".recaptcha-v2-submit").attr("data-psid"),s=t("#"+e),r=s.find(".recaptcha-v2-submit");o(a,"recaptcha_v2",s,0,parseInt(r.attr("data-area"))||0,r.attr("data-redirect")||"",r.attr("data-protection")||"")}})}),t(".recaptcha-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-recaptcha"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,i=e.attr("data-redirect")||"",c=e.attr("data-protection")||"";window.grecaptcha&&grecaptcha.ready(function(){grecaptcha.execute(ps_ajax.recaptcha_key,{action:"validate_input"}).then(function(t){o(t,"recaptcha_v3",r,0,n,i,c)})})}),t(".hcaptcha-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-recaptcha"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,c=e.attr("data-redirect")||"",p=e.attr("data-protection")||"";window.hcaptcha&&hcaptcha.execute({async:!0}).then(({response:t})=>{o(t,"hcaptcha",r,0,n,c,p)}).catch(t=>{i(r,t.message||"hCaptcha error")})});let c="";t(".turnstile-form").length>0&&window.turnstile&&(window.turnstile.ready(function(){window.turnstile.render(".passster-turnstile",{sitekey:ps_ajax.turnstile_key,callback(t){c=t}})}),t(".turnstile-form").on("submit",function(a){a.preventDefault();const e=t(this).find(".passster-submit-turnstile"),s=e.attr("data-psid"),r=t("#"+s),n=parseInt(e.attr("data-area"))||0,p=e.attr("data-redirect")||"",d=e.attr("data-protection")||"";c?o(c,"turnstile",r,0,n,p,d):i(r,"Please complete the verification.")})),t(document).on("click","#ps-logout",async function(){try{const t=await fetch(a+"/logout",{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"}});(await t.json()).success&&(Cookies.set("passster","",{expires:0,sameSite:"strict"}),window.location.href=s())}catch(t){window.location.href=s()}})}); | |