Cookie Auth

This commit is contained in:
TheEmeraldStarr 2020-10-03 20:24:46 -07:00
parent 01c94f39d4
commit c639877531
2 changed files with 16 additions and 25 deletions

View file

@ -75,36 +75,27 @@
</script> </script>
<div class="d-flex align-items-center order-12" style="height:200px;"> <div class="d-flex align-items-center order-12" style="height:200px;">
<div class="container border rounded text-center justify-content-center align-items-center button" style="color: rgb(255,255,255);filter: blur(0px); opacity: 0.95;"> <div class="container border rounded text-center justify-content-center align-items-center button" style="color: rgb(255,255,255);filter: blur(0px); opacity: 0.95;">
<form onkeydown="nu()"> <form>
<p style=" font-size: 46px; ">Node Unblocker</p> <p style=" font-size: 46px; ">Node Unblocker</p>
<p style="font-family: 'Montserrat Alternates', sans-serif; ">A flexible secondary proxy compared to Alloy, PM and PD.</p> <p style="font-family: 'Montserrat Alternates', sans-serif; ">A flexible secondary proxy compared to Alloy, PM and PD.</p>
<div class="input-group "> <div class="input-group ">
<div class="input-group-prepend"></div><input id="url" class="bg-dark border rounded-0 border-info shadow-sm form-control form-control-lg " type="text" name="url" style="width: 194px;font-family: <div class="input-group-prepend"></div><input id="url" class="bg-dark border rounded-0 border-info shadow-sm form-control form-control-lg " type="text" name="url" style="width: 194px;font-family:
'Montserrat Alternates', sans-serif;opacity: 0.80; color:rgb(255,255,255); " placeholder="Insert URL "> 'Montserrat Alternates', sans-serif;opacity: 0.80; color:rgb(255,255,255); " placeholder="Insert URL ">
<div class="input-group-append "><button id="nprox" class="btn btn-dark btn-lg bg-dark border rounded-0 border-info shadow-lg select " data-bs-hover-animate="pulse " name="button" type="submit " style="width: 78px;padding: 8px;margin: <div class="input-group-append "><button id="auth" class="btn btn-dark btn-lg bg-dark border rounded-0 border-info shadow-lg select " data-bs-hover-animate="pulse " name="button" type="submit " style="width: 78px;padding: 8px;margin:
0px;height: 46.126px;font-family: 'Montserrat Alternates', sans-serif;font-size: 16px; ">Go</button></div> 0px;height: 46.126px;font-family: 'Montserrat Alternates', sans-serif;font-size: 16px; ">Go</button></div>
</div> </div>
<div> <div>
<!-- Cookie Auth--> <!-- Cookie Auth-->
<script> <script>
function setCookie(name, value) { var btns = header.getElementsByClassName("auth");
document.cookie = name + '=' + encodeURIComponent(value) + '; expires=' + date + '; SameSite=None; Secure'; for (var i = 0; i < btns.length; i++) {
} btns[i].addEventListener("click", function() {
var current = document.getElementsByClassName("active");
function readCookie(name) { if (current.length > 0) {
var cookie = document.cookie.split('; '); current[0].className = current[0].className.replace(" active", "");
var cookies = {}; }
for (var i = 0; i < cookie.length; i++) { this.className += " active";
var cur = cookie[i].split('='); });
cookies[cur[0]] = cur[1];
}
return decodeURIComponent(cookies[name]);
}
/* Login Cookie*/
function Login(value) {
User(value);
setCookie('session', value);
} }
</script> </script>
</div> </div>

View file

@ -8,23 +8,23 @@ function $(id) {
$('nprox').onclick = function() { $('nprox').onclick = function() {
document.cookie = 'nu_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;'; document.cookie = 'nu_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
return false; return true;
}; };
$('pdprox').onclick = function() { $('pdprox').onclick = function() {
document.cookie = 'pd_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;'; document.cookie = 'pd_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
return false; return true;
}; };
$('pmprox').onclick = function() { $('pmprox').onclick = function() {
document.cookie = 'pm_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;'; document.cookie = 'pm_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
return false; return true;
}; };
// AL Auth // AL Auth
$('al').onclick = function() { $('al').onclick = function() {
document.cookie = 'al_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;'; document.cookie = 'al_auth=yes; expires=' + (Date.now() + 259200) + '; sameSite=none; domain=.' + auth + '; path=/; secure;';
return false; return true;
}; };
// Cookie Auth // Cookie Auth
@ -34,7 +34,7 @@ if (host.length == 3) {
auth = `${host[1]}.${host[2]}`; auth = `${host[1]}.${host[2]}`;
} }
Array.from(document.getElementsByTagName('button')).forEach(e => { Array.from(document.getElementById('auth')).forEach(e => {
e.addEventListener('click', () => { e.addEventListener('click', () => {
document.cookie = 'session; max-age=259200; sameSite=lax; domain=' + auth + '; path=/; secure;'; document.cookie = 'session; max-age=259200; sameSite=lax; domain=' + auth + '; path=/; secure;';
}); });