move auth pages into auth dir

This commit is contained in:
Huskydog9988
2025-03-22 15:54:43 -04:00
parent 6918e78cf9
commit 6ed7e76b17
7 changed files with 10 additions and 7 deletions

View File

@ -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)}`,
});
}

View File

@ -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 &&

View File

@ -43,5 +43,5 @@ user.value = null;
// Redirect to signin page after signout
await $dropFetch("/signout");
router.push("/signin");
router.push("/auth/signin");
</script>

View File

@ -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";

View File

@ -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)}`
);
}
});

View File

@ -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");
});