Albirew/nyaa-pantsu
Archivé
1
0
Bifurcation 0

Fix login that didnt work at times because of very old cookies that didnt expire (#1628)

* Update main.js

* Update main.js
Cette révision appartient à :
kilo 2017-10-02 20:49:46 +02:00 révisé par GitHub
Parent e49dd1a7b9
révision 415db8ca06

Voir le fichier

@ -87,8 +87,7 @@ parseAllDates()
//called if no Commit cookie is set or if the website has a newer commit than the one in cookie
function resetCookies() {
var cookies = document.cookie.split(";")
var excludedCookies = ["mascot", "version", "theme", "theme2", "mascot_url", "lang", "csrf_token", "altColors", "EU_Cookie", "oldNav"]
var ignoredCookies = ["session"]
var excludedCookies = ["session", "mascot", "version", "theme", "theme2", "mascot_url", "lang", "csrf_token", "altColors", "EU_Cookie", "oldNav"]
//Excluded cookies are either left untouched or deleted then re-created
//Ignored Cookies are constantly left untouched
@ -114,13 +113,14 @@ function resetCookies() {
var cookieValue = getCookieValue(cookieName)
document.cookie = cookieName + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;"
document.cookie = cookieName + "=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;"
document.cookie = cookieName + "=" + cookieValue + ";path=/;expires=" + farFutureString + ";domain=" + domain
if(cookieName != session)
document.cookie = cookieName + "=" + cookieValue + ";path=/;expires=" + farFutureString + ";domain=" + domain
else document.cookie = cookieName + "=" + cookieValue + ";path=/;expires=" + farFutureString
//Remove cookie from both current & general path, then re-create it to ensure domain is correct
//Force current domain for session cookie
}
continue
}
if (ignoredCookies.includes(cookieName))
continue
document.cookie = cookieName + "=;expires=Thu, 01 Jan 1970 00:00:00 UTC;"
document.cookie = cookieName + "=;path=/;expires=Thu, 01 Jan 1970 00:00:00 UTC;"
}