diff --git a/src/lib/KratosForm.svelte b/src/lib/KratosForm.svelte new file mode 100644 index 0000000..88df0d9 --- /dev/null +++ b/src/lib/KratosForm.svelte @@ -0,0 +1,148 @@ + + +{#if ui.messages} + {#each ui.messages as message} + {#if message.type == 'info'} +
+
+ + {message.text} +
+
+ {:else if message.type == 'error'} +
+
+ + {message.text} +
+
+ {:else} +
+
+ {message.text} +
+
+ {/if} + {/each} +{/if} + +
+ {#each ui.nodes as node} + {#if isUiNodeTextAttributes(node.attributes)} + {node.attributes.text.text} + {:else if isUiNodeInputAttributes(node.attributes)} + {#if node.attributes.type == 'button' || node.attributes.type == 'submit'} +
+ +
+ {:else if node.attributes.type == 'text' || node.attributes.type == 'password' || node.attributes.type == 'number' || node.attributes.type == 'email' || node.attributes.type == 'tel' || node.attributes.type == 'datetime-local' || node.attributes.type == 'date' || node.attributes.type == 'url'} +
+ {#if node.meta.label} + + {/if} + +
+ {:else if node.attributes.type == 'checkbox'} +
+ +
+ {:else if node.attributes.type == 'hidden'} + + {/if} + {:else if isUiNodeImageAttributes(node.attributes)} + {getNodeLabel(node)} + {:else if isUiNodeAnchorAttributes(node.attributes)} + + {getNodeLabel(node)} + + {:else if isUiNodeScriptAttributes(node.attributes)} + {#if browser} + + {/if} + {/if} + {/each} +
diff --git a/src/routes/login/+page.server.ts b/src/routes/login/+page.server.ts index 0cf7e55..c4e44ef 100644 --- a/src/routes/login/+page.server.ts +++ b/src/routes/login/+page.server.ts @@ -57,7 +57,6 @@ export const load: PageServerLoad = async ({ url, request }) => { )}/self-service/registration/browser?${initFlowQuery.toString()}`; return { - nodes: login_flow.ui.nodes, KRATOS_PUBLIC_URL: KRATOS_PUBLIC_URL, flow: login_flow as SelfServiceLoginFlow, title: !(login_flow.refresh || login_flow.requested_aal === 'aal2') diff --git a/src/routes/login/+page.svelte b/src/routes/login/+page.svelte index 8f255f3..973aa05 100644 --- a/src/routes/login/+page.svelte +++ b/src/routes/login/+page.svelte @@ -1,83 +1,21 @@
-
+

{data.title}

{#if data.subtitle}

{data.subtitle}

{/if} - {#if data.flow.ui.messages} - {#each data.flow.ui.messages as message} -
-
- - {message.text} -
-
- {/each} - {/if} - {#each data.nodes as node} - - {#if node.attributes.type == 'submit'} - - {:else if node.meta.label} -
- - {#if node.attributes.type == 'text' || node.attributes.type == 'password'} - - {:else} - - {/if} -
- {:else} - - {/if} - {#each node.messages as message} -
-
- - {message.text} -
-
- {/each} - {/each} + {#if data.title == 'Two-Factor Authentication'} Log out {:else} - Forgot password? + Forgot password?
Sign up instead {/if} - - +
diff --git a/src/routes/recovery/+page.server.ts b/src/routes/recovery/+page.server.ts index 77c5c07..6b038ed 100644 --- a/src/routes/recovery/+page.server.ts +++ b/src/routes/recovery/+page.server.ts @@ -33,7 +33,6 @@ export const load: PageServerLoad = async ({ url, request }) => { }).toString()}`; return { - nodes: recovery_flow.ui.nodes, KRATOS_PUBLIC_URL: KRATOS_PUBLIC_URL, flow: recovery_flow, loginURL: initLoginUrl diff --git a/src/routes/recovery/+page.svelte b/src/routes/recovery/+page.svelte index cc59013..34935e3 100644 --- a/src/routes/recovery/+page.svelte +++ b/src/routes/recovery/+page.svelte @@ -1,57 +1,18 @@
-

Recover Account

- {#if data.flow.ui.messages} - {#each data.flow.ui.messages as message} -
-
- - {message.text} -
-
- {/each} - {/if} - {#each data.nodes as node} - - {#if node.type == 'a'} - {node.meta.label?.text} - {:else if node.attributes.type == 'submit'} - - {:else if node.meta.label} -
- - {#if node.attributes.type == 'text' || node.attributes.type == 'password' || node.attributes.type == 'email'} - - {:else} - - {/if} -
- {:else} - - {/if} - {/each} + Sign up - +
diff --git a/src/routes/registration/+page.server.ts b/src/routes/registration/+page.server.ts index 97005d3..89486f8 100644 --- a/src/routes/registration/+page.server.ts +++ b/src/routes/registration/+page.server.ts @@ -46,7 +46,6 @@ export const load: PageServerLoad = async ({ url, request }) => { )}/self-service/login/browser?${initFlowQuery.toString()}`; return { - nodes: registration_flow.ui.nodes, KRATOS_PUBLIC_URL: KRATOS_PUBLIC_URL, flow: registration_flow as SelfServiceRegistrationFlow, title: 'Register Account', diff --git a/src/routes/registration/+page.svelte b/src/routes/registration/+page.svelte index c401bd6..9e94735 100644 --- a/src/routes/registration/+page.svelte +++ b/src/routes/registration/+page.svelte @@ -1,78 +1,16 @@
-
+

{data.title}

{#if data.subtitle}

{data.subtitle}

{/if} - {#if data.flow.ui.messages} - {#each data.flow.ui.messages as message} -
-
- - {message.text} -
-
- {/each} - {/if} - {#each data.nodes as node} - - {#if node.attributes.type == 'submit'} - - {:else if node.meta.label} -
- - {#if node.attributes.type == 'text' || node.attributes.type == 'password' || node.attributes.type == 'email'} - - {:else} - - {/if} -
- {:else} - - {/if} - {#each node.messages as message} -
-
- - {message.text} -
-
- {/each} - {/each} - Log out - - + + Log in instead +
diff --git a/src/routes/verification/+page.server.ts b/src/routes/verification/+page.server.ts index 8adb4cb..8bc98f2 100644 --- a/src/routes/verification/+page.server.ts +++ b/src/routes/verification/+page.server.ts @@ -34,7 +34,6 @@ export const load: PageServerLoad = async ({ url, request }) => { }).toString()}`; return { - nodes: verification_flow.ui.nodes, KRATOS_PUBLIC_URL: KRATOS_PUBLIC_URL, flow: verification_flow, signupURL: initRegistrationUrl diff --git a/src/routes/verification/+page.svelte b/src/routes/verification/+page.svelte index dd9ae5c..ae6e49e 100644 --- a/src/routes/verification/+page.svelte +++ b/src/routes/verification/+page.svelte @@ -1,57 +1,13 @@
-
+

Verify Account

- {#if data.flow.ui.messages} - {#each data.flow.ui.messages as message} -
-
- - {message.text} -
-
- {/each} - {/if} - {#each data.nodes as node} - - {#if node.type == 'a'} - {node.meta.label?.text} - {:else if node.attributes.type == 'submit'} - - {:else if node.meta.label} -
- - {#if node.attributes.type == 'text' || node.attributes.type == 'password' || node.attributes.type == 'email'} - - {:else} - - {/if} -
- {:else} - - {/if} - {/each} + Sign up - +