mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
move auth pages into auth dir
This commit is contained in:
@ -16,7 +16,7 @@ const showSignIn = statusCode ? statusCode == 403 || statusCode == 401 : false;
|
||||
|
||||
async function signIn() {
|
||||
clearError({
|
||||
redirect: `/signin?redirect=${encodeURIComponent(route.fullPath)}`,
|
||||
redirect: `/auth/signin?redirect=${encodeURIComponent(route.fullPath)}`,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const whitelistedPrefixes = ["/signin", "/register", "/api", "/setup"];
|
||||
const whitelistedPrefixes = ["/auth/signin", "/register", "/api", "/setup"];
|
||||
const requireAdmin = ["/admin"];
|
||||
|
||||
export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
@ -13,7 +13,10 @@ export default defineNuxtRouteMiddleware(async (to, from) => {
|
||||
await updateUser();
|
||||
}
|
||||
if (!user.value) {
|
||||
return navigateTo({ path: "/signin", query: { redirect: to.fullPath } });
|
||||
return navigateTo({
|
||||
path: "/auth/signin",
|
||||
query: { redirect: to.fullPath },
|
||||
});
|
||||
}
|
||||
if (
|
||||
requireAdmin.findIndex((e) => to.fullPath.startsWith(e)) != -1 &&
|
||||
|
||||
@ -43,5 +43,5 @@ user.value = null;
|
||||
|
||||
// Redirect to signin page after signout
|
||||
await $dropFetch("/signout");
|
||||
router.push("/signin");
|
||||
router.push("/auth/signin");
|
||||
</script>
|
||||
@ -248,7 +248,7 @@ function register_wrapper() {
|
||||
loading.value = true;
|
||||
register()
|
||||
.then(() => {
|
||||
router.push("/signin");
|
||||
router.push("/auth/signin");
|
||||
})
|
||||
.catch((response) => {
|
||||
const message = response.statusMessage || "An unknown error occurred";
|
||||
|
||||
@ -18,7 +18,7 @@ export default defineNitroPlugin((nitro) => {
|
||||
if (userId) break;
|
||||
return sendRedirect(
|
||||
event,
|
||||
`/signin?redirect=${encodeURIComponent(event.path)}`
|
||||
`/auth/signin?redirect=${encodeURIComponent(event.path)}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
@ -3,5 +3,5 @@ import sessionHandler from "../internal/session";
|
||||
export default defineEventHandler(async (h3) => {
|
||||
await sessionHandler.clearSession(h3);
|
||||
|
||||
return sendRedirect(h3, "/signin");
|
||||
return sendRedirect(h3, "/auth/signin");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user