Skip to content

Commit bca58ab

Browse files
committed
fix: can't sign in by cookie on leetcode-cn site
1 parent cd5d4ef commit bca58ab

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/plugins/leetcode.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -534,15 +534,10 @@ plugin.login = function(user, cb) {
534534
};
535535

536536
function parseCookie(cookie, body, cb) {
537-
const isCN = config.app === 'leetcode.cn';
538537
const SessionPattern = /LEETCODE_SESSION=(.+?)(;|$)/;
539538
let csrfPattern;
540-
if (isCN) {
541-
csrfPattern = /name="csrfmiddlewaretoken" value="(.*?)"/;
542-
} else {
543-
csrfPattern = /csrftoken=(.+?)(;|$)/;
544-
}
545-
const reCsrfResult = csrfPattern.exec(isCN? body: cookie);
539+
csrfPattern = /csrftoken=(.+?)(;|$)/;
540+
const reCsrfResult = csrfPattern.exec(cookie);
546541
const reSessionResult = SessionPattern.exec(cookie);
547542
if (reSessionResult === null || reCsrfResult === null) {
548543
return cb('invalid cookie?');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy