mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-08 12:04:50 +08:00
validate cookie on login
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -236,6 +236,20 @@ class LoginPageController extends GetxController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String validateCookie(String cookie) {
|
||||||
|
return cookie
|
||||||
|
.split(';')
|
||||||
|
.where((e) {
|
||||||
|
try {
|
||||||
|
Cookie.fromSetCookieValue(e.trim());
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
})
|
||||||
|
.join(';');
|
||||||
|
}
|
||||||
|
|
||||||
// cookie登录
|
// cookie登录
|
||||||
Future<void> loginByCookie() async {
|
Future<void> loginByCookie() async {
|
||||||
if (cookieTextController.text.isEmpty) {
|
if (cookieTextController.text.isEmpty) {
|
||||||
@@ -247,7 +261,7 @@ class LoginPageController extends GetxController
|
|||||||
"/x/member/web/account",
|
"/x/member/web/account",
|
||||||
options: Options(
|
options: Options(
|
||||||
headers: {
|
headers: {
|
||||||
"cookie": cookieTextController.text,
|
"cookie": validateCookie(cookieTextController.text),
|
||||||
},
|
},
|
||||||
extra: {'account': AnonymousAccount()},
|
extra: {'account': AnonymousAccount()},
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user