mirror of
https://github.com/halo-dev/theme-earth.git
synced 2025-10-14 06:21:09 +00:00
refactor: change login url (#188)
Halo 2.20 将提供新的登录入口(/login),此 PR 用于适配新的登录地址。 See more: https://github.com/halo-dev/halo/pull/6488 /kind improvement ```release-note 适配 Halo 2.20 的新登录入口。 ```
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
export default () => ({
|
||||
async handleLogout() {
|
||||
if (confirm("确定要退出登录吗?")) {
|
||||
await fetch(`/logout`, {
|
||||
method: "POST",
|
||||
credentials: "same-origin",
|
||||
headers: {
|
||||
"X-Xsrf-Token":
|
||||
document.cookie
|
||||
.split("; ")
|
||||
.find((row) => row.startsWith("XSRF-TOKEN"))
|
||||
?.split("=")[1] || "",
|
||||
},
|
||||
});
|
||||
window.location.reload();
|
||||
}
|
||||
},
|
||||
});
|
@@ -6,7 +6,6 @@ import dropdown from "./alpine-data/dropdown";
|
||||
import colorSchemeSwitcher from "./alpine-data/color-scheme-switcher";
|
||||
import upvote from "./alpine-data/upvote";
|
||||
import share from "./alpine-data/share";
|
||||
import logout from "./alpine-data/logout";
|
||||
import uiPermission from "./alpine-data/ui-permission";
|
||||
|
||||
window.Alpine = Alpine;
|
||||
@@ -17,7 +16,6 @@ Alpine.data("colorSchemeSwitcher", colorSchemeSwitcher);
|
||||
Alpine.data("upvote", upvote);
|
||||
// @ts-ignore
|
||||
Alpine.data("share", share);
|
||||
Alpine.data("logout", logout);
|
||||
// @ts-ignore
|
||||
Alpine.data("uiPermission", uiPermission);
|
||||
|
||||
|
@@ -130,14 +130,13 @@
|
||||
<li
|
||||
sec:authorize="isAuthenticated()"
|
||||
class="flex w-full items-center text-left text-sm hover:bg-gray-50 dark:hover:bg-slate-600"
|
||||
x-data="logout"
|
||||
@click="handleLogout"
|
||||
>
|
||||
<span
|
||||
<a
|
||||
class="size-full truncate px-4 py-2 text-gray-600 hover:text-blue-600 dark:text-slate-50 dark:hover:text-gray-300"
|
||||
href="/logout"
|
||||
>
|
||||
退出登录
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<li
|
||||
sec:authorize="isAnonymous()"
|
||||
@@ -145,7 +144,7 @@
|
||||
>
|
||||
<a
|
||||
class="size-full truncate px-4 py-2 text-gray-600 hover:text-blue-600 dark:text-slate-50 dark:hover:text-gray-300"
|
||||
href="/console/login"
|
||||
href="/login?redirect_uri=/"
|
||||
>
|
||||
登录
|
||||
</a>
|
||||
|
@@ -19,7 +19,7 @@ spec:
|
||||
settingName: "theme-earth-setting"
|
||||
configMapName: "theme-earth-configMap"
|
||||
version: 1.10.0
|
||||
requires: ">=2.19.0"
|
||||
requires: ">=2.20.0"
|
||||
license:
|
||||
- name: "GPL-3.0"
|
||||
url: "https://github.com/halo-dev/theme-earth/blob/main/LICENSE"
|
||||
|
Reference in New Issue
Block a user