Skip to content

Commit 6c7658a

Browse files
committed
Add user to signup page
1 parent 55d01d6 commit 6c7658a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

apps/web/src/routes/(app)/signup/+page.svelte

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import { WEB_ROUTES_SERVICE } from '@gitbutler/shared/routing/webRoutes.svelte';
77
import { Button, EmailTextbox, Textbox, InfoMessage } from '@gitbutler/ui';
88
9+
let username = $state<string>();
910
let email = $state<string>();
1011
let password = $state<string>();
1112
let passwordConfirmation = $state<string>();
@@ -19,8 +20,8 @@
1920
2021
async function handleSubmit(event: Event) {
2122
event.preventDefault();
22-
if (!email || !password || !passwordConfirmation) {
23-
error = 'Email and password are required';
23+
if (!username || !email || !password || !passwordConfirmation) {
24+
error = 'Username, email and password are required';
2425
return;
2526
}
2627
@@ -30,6 +31,7 @@
3031
}
3132
3233
const response = await loginService.createAccountWithEmail(
34+
username,
3335
email,
3436
password,
3537
passwordConfirmation
@@ -61,6 +63,7 @@
6163
>
6264
<form id="signup-form" class="stack-v" onsubmit={handleSubmit}>
6365
<div class="auth-form__inputs">
66+
<Textbox bind:value={username} label="Username" />
6467
<EmailTextbox
6568
label="Email"
6669
placeholder=" "

packages/shared/src/lib/login/loginService.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,15 @@ export default class LoginService {
126126
}
127127

128128
async createAccountWithEmail(
129+
username: string,
129130
email: string,
130131
password: string,
131132
passwordConfirmation: string
132133
): Promise<LoginResponse<{ message: string }>> {
133134
return await this.sendPostRequest(
134135
'sessions/sign_up_email',
135136
{
137+
login: username,
136138
email,
137139
password,
138140
password_confirmation: passwordConfirmation

0 commit comments

Comments
 (0)