From 010eab0196b767f90c540242a58bf68841ebee45 Mon Sep 17 00:00:00 2001 From: Andrea Fazzi Date: Wed, 5 Oct 2022 09:26:09 +0200 Subject: [PATCH] Move auth routes in auth subfolder --- .../quickstart/kratos/cloud/kratos.yml | 15 ++++----- frontend/src/routes/+layout.svelte | 1 - frontend/src/routes/+page.svelte | 6 ++-- .../src/routes/{ => auth}/login/+page.svelte | 33 +++++++++---------- .../src/routes/{ => auth}/logout/+page.svelte | 0 .../src/routes/{ => auth}/logout/+page.ts | 0 .../routes/{ => auth}/recovery/+page.svelte | 0 .../{ => auth}/registration/+page.svelte | 3 +- .../routes/{ => auth}/settings/+page.svelte | 0 .../{ => auth}/verification/+page.svelte | 0 frontend/src/routes/dashboard/+page.svelte | 4 +-- 11 files changed, 28 insertions(+), 34 deletions(-) rename frontend/src/routes/{ => auth}/login/+page.svelte (54%) rename frontend/src/routes/{ => auth}/logout/+page.svelte (100%) rename frontend/src/routes/{ => auth}/logout/+page.ts (100%) rename frontend/src/routes/{ => auth}/recovery/+page.svelte (100%) rename frontend/src/routes/{ => auth}/registration/+page.svelte (95%) rename frontend/src/routes/{ => auth}/settings/+page.svelte (100%) rename frontend/src/routes/{ => auth}/verification/+page.svelte (100%) diff --git a/docker/kratos/contrib/quickstart/kratos/cloud/kratos.yml b/docker/kratos/contrib/quickstart/kratos/cloud/kratos.yml index 2f893c1..c8e41bb 100644 --- a/docker/kratos/contrib/quickstart/kratos/cloud/kratos.yml +++ b/docker/kratos/contrib/quickstart/kratos/cloud/kratos.yml @@ -26,7 +26,6 @@ serve: base_url: http://kratos:4434/ selfservice: - # default_browser_return_url: http://localhost:4455/ui/welcome default_browser_return_url: http://localhost:3000/ allowed_return_urls: - http://localhost:3000 @@ -37,31 +36,31 @@ selfservice: flows: error: - ui_url: http://localhost:3000/login + ui_url: http://localhost:3000/auth/login settings: - ui_url: http://localhost:3000/settings + ui_url: http://localhost:3000/auth/settings privileged_session_max_age: 15m recovery: enabled: true - ui_url: http://localhost:3000/recovery + ui_url: http://localhost:3000/auth/recovery verification: enabled: true - ui_url: http://localhost:3000/verification + ui_url: http://localhost:3000/auth/verification after: default_browser_return_url: http://localhost:3000/ logout: after: - default_browser_return_url: http://localhost:3000/login + default_browser_return_url: http://localhost:3000/auth/login login: - ui_url: http://localhost:3000/login + ui_url: http://localhost:3000/auth/login registration: - ui_url: http://localhost:3000/registration + ui_url: http://localhost:3000/auth/registration after: password: hooks: diff --git a/frontend/src/routes/+layout.svelte b/frontend/src/routes/+layout.svelte index e17ede8..6226c83 100644 --- a/frontend/src/routes/+layout.svelte +++ b/frontend/src/routes/+layout.svelte @@ -8,7 +8,6 @@ if (browser) { if (_identity.id) { console.log("signed in"); - console.log(_identity); } else { console.log("not signed in"); } diff --git a/frontend/src/routes/+page.svelte b/frontend/src/routes/+page.svelte index 3e79409..a980213 100644 --- a/frontend/src/routes/+page.svelte +++ b/frontend/src/routes/+page.svelte @@ -8,11 +8,11 @@
-

welcome

+

Probo

{#if !_identity.id} -

login

+

Login

{:else} -

Dashboard

+

Dashboard

{/if}
diff --git a/frontend/src/routes/login/+page.svelte b/frontend/src/routes/auth/login/+page.svelte similarity index 54% rename from frontend/src/routes/login/+page.svelte rename to frontend/src/routes/auth/login/+page.svelte index 33f97c5..c7c19ac 100644 --- a/frontend/src/routes/login/+page.svelte +++ b/frontend/src/routes/auth/login/+page.svelte @@ -15,25 +15,22 @@
- {#await pr then dm} - {#if dm.instanceOf === "KratosForm"} -
-

Sign in

+ {#await pr then dm} {#if dm.instanceOf === "KratosForm"} +
+

Sign in

- {#if dm.ui.messages} - - {/if} -
+ {#if dm.ui.messages} + + {/if} -
+
- -
- {:else} -

Something went wrong

- {/if} - {/await} +
+

Forget password?

+

Don't have an account?

+
+
+ {:else} +

Something went wrong

+ {/if} {/await}
diff --git a/frontend/src/routes/logout/+page.svelte b/frontend/src/routes/auth/logout/+page.svelte similarity index 100% rename from frontend/src/routes/logout/+page.svelte rename to frontend/src/routes/auth/logout/+page.svelte diff --git a/frontend/src/routes/logout/+page.ts b/frontend/src/routes/auth/logout/+page.ts similarity index 100% rename from frontend/src/routes/logout/+page.ts rename to frontend/src/routes/auth/logout/+page.ts diff --git a/frontend/src/routes/recovery/+page.svelte b/frontend/src/routes/auth/recovery/+page.svelte similarity index 100% rename from frontend/src/routes/recovery/+page.svelte rename to frontend/src/routes/auth/recovery/+page.svelte diff --git a/frontend/src/routes/registration/+page.svelte b/frontend/src/routes/auth/registration/+page.svelte similarity index 95% rename from frontend/src/routes/registration/+page.svelte rename to frontend/src/routes/auth/registration/+page.svelte index 94300ef..d00870a 100644 --- a/frontend/src/routes/registration/+page.svelte +++ b/frontend/src/routes/auth/registration/+page.svelte @@ -7,12 +7,11 @@ import Messages from "$lib/components/kratos/messages.svelte"; const flowId = getFlowId($page.url.search); - console.log(browser, flowId); + if (browser && !flowId) window.location.href = `${KRATOS}/self-service/registration/browser`; const pr = getDataModels("registration", flowId); - console.log(pr); diff --git a/frontend/src/routes/settings/+page.svelte b/frontend/src/routes/auth/settings/+page.svelte similarity index 100% rename from frontend/src/routes/settings/+page.svelte rename to frontend/src/routes/auth/settings/+page.svelte diff --git a/frontend/src/routes/verification/+page.svelte b/frontend/src/routes/auth/verification/+page.svelte similarity index 100% rename from frontend/src/routes/verification/+page.svelte rename to frontend/src/routes/auth/verification/+page.svelte diff --git a/frontend/src/routes/dashboard/+page.svelte b/frontend/src/routes/dashboard/+page.svelte index d8b0bfd..917c98c 100644 --- a/frontend/src/routes/dashboard/+page.svelte +++ b/frontend/src/routes/dashboard/+page.svelte @@ -14,6 +14,6 @@

Dashboard

Hello {email}

-

Settings

-

Logout

+

Settings

+

Logout