mirror of
https://github.com/lifegpc/eh-downloader.git
synced 2026-06-06 05:38:44 +08:00
Add secure if login with https protocol
This commit is contained in:
@@ -51,6 +51,9 @@ export default class CreateRootUser extends Component<Props> {
|
||||
b.append("password", p2);
|
||||
b.append("t", t.toString());
|
||||
b.append("set_cookie", "1");
|
||||
if (document.location.protocol === "https:") {
|
||||
b.append("secure", "1");
|
||||
}
|
||||
const re2 = await fetch("/api/token", { method: "PUT", body: b });
|
||||
const token = await re2.json();
|
||||
if (!token.ok) {
|
||||
|
||||
@@ -43,6 +43,9 @@ export default class Login extends Component<Props> {
|
||||
b.append("password", p2);
|
||||
b.append("t", t.toString());
|
||||
b.append("set_cookie", "1");
|
||||
if (document.location.protocol === "https:") {
|
||||
b.append("secure", "1");
|
||||
}
|
||||
const re2 = await fetch("/api/token", { method: "PUT", body: b });
|
||||
const token = await re2.json();
|
||||
if (!token.ok) {
|
||||
|
||||
Reference in New Issue
Block a user