@@ -4,11 +4,10 @@ import { page } from '$app/stores';
4
4
import * as m from ' $i18n/messages' ;
5
5
import { handleMessage } from ' $lib/components/layout/toast-manager' ;
6
6
import { i18n } from ' $lib/i18n' ;
7
- import { updateUserDetailsKeys as keys , signUpSchema } from ' $lib/schema/user' ;
7
+ import { signUpSchema , updateUserDetailsKeys as keys } from ' $lib/schema/user' ;
8
8
import { getLoadingState } from ' $lib/stores/loading' ;
9
9
import { getNhostClient } from ' $lib/stores/nhost' ;
10
10
import { turnstilePassed , turnstileResponse } from ' $lib/stores/stores' ;
11
- import { getAuthenticationResult , signUpEmailPasswordPromise } from ' @nhost/nhost-js' ;
12
11
import { getToastStore } from ' @skeletonlabs/skeleton' ;
13
12
import { DebugShell } from ' $lib/ui/components' ;
14
13
import { Alerts } from ' $lib/ui/components/form' ;
@@ -49,36 +48,22 @@ const form = superForm(defaults(zod(signUpSchema)), {
49
48
if (! form .valid ) return ;
50
49
51
50
const { firstName, lastName, email, password, locale, redirectTo } = form .data ;
52
-
53
- // FIXME: remove this block after nhost.auth.signUp support headers
54
- const { session, error } = getAuthenticationResult (
55
- await signUpEmailPasswordPromise (
56
- // biome-ignore lint/style/noNonNullAssertion: <explanation>
57
- nhost .auth .client .interpreter ! ,
51
+ const { session, error } = await nhost .auth .signUp (
52
+ {
58
53
email ,
59
- password as string ,
60
- {
54
+ password ,
55
+ options: {
61
56
displayName: ` ${firstName } ${lastName } ` ,
62
57
locale ,
63
58
},
64
- {
65
- headers: {
66
- ' x-cf-turnstile-response ' : $turnstileResponse ,
67
- } ,
59
+ },
60
+ {
61
+ headers: {
62
+ ' x-cf-turnstile-response ' : $turnstileResponse ,
68
63
},
69
- ) ,
64
+ } ,
70
65
);
71
66
72
- // log.debug('TODO: use turnstileResponse:', $turnstileResponse);
73
- // const { session, error } = await nhost.auth.signUp({
74
- // email,
75
- // password,
76
- // options: {
77
- // displayName: `${firstName} ${lastName}`,
78
- // locale,
79
- // },
80
- // });
81
-
82
67
if (error ) {
83
68
log .error (error );
84
69
// FIXME: workaround for `missing x-cf-turnstile-response`
@@ -140,18 +125,18 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
140
125
141
126
<svelte:head >
142
127
<title >Datablocks | Signup</title >
143
- <meta name =" description" content =" Create Account" />
128
+ <meta name =" description" content =" Create Account" />
144
129
</svelte:head >
145
130
146
131
<!-- Form Level Errors / Messages -->
147
- <Alerts errors ={$errors ._errors } message ={$message } />
132
+ <Alerts errors ={$errors ._errors } message ={$message }/>
148
133
<!-- Signup Form -->
149
134
<form method =" POST" use:enhance >
150
135
<div class =" mt-6" >
151
136
<Form .Field {form } name =" firstName" >
152
137
<Form .Control let:attrs >
153
138
<Form .Label class =" label sr-only"
154
- >{m .auth_forms_first_name_label ()}</Form .Label
139
+ >{m .auth_forms_first_name_label ()}</Form .Label
155
140
>
156
141
<input
157
142
type =" text"
@@ -162,14 +147,14 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
162
147
bind:value ={$formData .firstName }
163
148
/>
164
149
</Form .Control >
165
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
150
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
166
151
</Form .Field >
167
152
</div >
168
153
<div class =" mt-6" >
169
154
<Form .Field {form } name =" lastName" >
170
155
<Form .Control let:attrs >
171
156
<Form .Label class =" label sr-only"
172
- >{m .auth_forms_last_name_label ()}</Form .Label
157
+ >{m .auth_forms_last_name_label ()}</Form .Label
173
158
>
174
159
<input
175
160
type =" text"
@@ -180,14 +165,14 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
180
165
bind:value ={$formData .lastName }
181
166
/>
182
167
</Form .Control >
183
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
168
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
184
169
</Form .Field >
185
170
</div >
186
171
<div class =" mt-6" >
187
172
<Form .Field {form } name =" email" >
188
173
<Form .Control let:attrs >
189
174
<Form .Label class =" label sr-only"
190
- >{m .auth_forms_email_label ()}</Form .Label
175
+ >{m .auth_forms_email_label ()}</Form .Label
191
176
>
192
177
<input
193
178
type =" email"
@@ -198,14 +183,14 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
198
183
bind:value ={$formData .email }
199
184
/>
200
185
</Form .Control >
201
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
186
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
202
187
</Form .Field >
203
188
</div >
204
189
<div class =" mt-6" >
205
190
<Form .Field {form } name =" password" >
206
191
<Form .Control let:attrs >
207
192
<Form .Label class =" label sr-only"
208
- >{m .auth_forms_password_label ()}</Form .Label
193
+ >{m .auth_forms_password_label ()}</Form .Label
209
194
>
210
195
<input
211
196
type =" password"
@@ -215,14 +200,14 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
215
200
bind:value ={$formData .password }
216
201
/>
217
202
</Form .Control >
218
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
203
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
219
204
</Form .Field >
220
205
</div >
221
206
<div class =" mt-6" >
222
207
<Form .Field {form } name =" confirmPassword" >
223
208
<Form .Control let:attrs >
224
209
<Form .Label class =" label sr-only"
225
- >{m .auth_forms_confirm_password_label ()}</Form .Label
210
+ >{m .auth_forms_confirm_password_label ()}</Form .Label
226
211
>
227
212
<input
228
213
type =" password"
@@ -232,13 +217,13 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
232
217
bind:value ={$formData .confirmPassword }
233
218
/>
234
219
</Form .Control >
235
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
220
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
236
221
</Form .Field >
237
222
</div >
238
223
<div class =" mt-6" >
239
224
<Form .Field {form } name ={keys .locale }>
240
225
<Form .Control let:attrs >
241
- <Form .Label class =" label sr-only" >Locale</Form .Label >
226
+ <Form .Label class =" label sr-only" >Locale</Form .Label >
242
227
<select
243
228
class =" select data-[fs-error]:input-error"
244
229
{...attrs }
@@ -250,7 +235,7 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
250
235
</select >
251
236
</Form .Control >
252
237
<!-- <Form.Description class="sr-only md:not-sr-only text-sm text-gray-500">User preferred Locale</Form.Description> -->
253
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
238
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
254
239
</Form .Field >
255
240
</div >
256
241
<div class =" mt-6" >
@@ -268,11 +253,11 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
268
253
<a href =" /terms" class =" text-primaryHover underline" >terms</a >
269
254
and
270
255
<a href =" /privacy" class =" text-primaryHover underline"
271
- >privacy policy</a
256
+ >privacy policy</a
272
257
>
273
258
</span >
274
259
</Form .Control >
275
- <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
260
+ <Form .FieldErrors class =" data-[fs-error]:text-error-500" />
276
261
</Form .Field >
277
262
</div >
278
263
<div class =" mt-6" >
@@ -282,9 +267,9 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
282
267
disabled ={! $tainted || ! valid || $submitting }
283
268
>
284
269
{#if $timeout }
285
- <MoreHorizontal class =" animate-ping" />
270
+ <MoreHorizontal class =" animate-ping" />
286
271
{:else if $delayed }
287
- <Loader class =" animate-spin" />
272
+ <Loader class =" animate-spin" />
288
273
{:else }
289
274
{m .auth_labels_signup ()}
290
275
{/if }
@@ -303,14 +288,14 @@ $formData.redirectTo = $page.url.searchParams.get('redirectTo') ?? $formData.red
303
288
timeout : $timeout
304
289
}}
305
290
/>
306
- <br />
307
- <SuperDebug label ="Form" data ={$formData } />
308
- <br />
309
- <SuperDebug label ="Tainted" status ={false } data ={$tainted } />
310
- <br />
311
- <SuperDebug label ="Errors" status ={false } data ={$errors } />
312
- <br />
313
- <SuperDebug label ="Constraints" status ={false } data ={$constraints } />
291
+ <br />
292
+ <SuperDebug label ="Form" data ={$formData }/>
293
+ <br />
294
+ <SuperDebug label ="Tainted" status ={false } data ={$tainted }/>
295
+ <br />
296
+ <SuperDebug label ="Errors" status ={false } data ={$errors }/>
297
+ <br />
298
+ <SuperDebug label ="Constraints" status ={false } data ={$constraints }/>
314
299
<!-- <br />
315
300
<SuperDebug label="$page data" status={false} data={$page} /> -->
316
301
</DebugShell >
0 commit comments