Skip to content

Commit 888c43a

Browse files
committed
feat(setup): organization is not longer needed
1 parent 4b7c710 commit 888c43a

File tree

9 files changed

+21
-47
lines changed

9 files changed

+21
-47
lines changed

cli/login.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,9 @@ func login() *cobra.Command {
163163
}
164164

165165
_, err = client.CreateFirstUser(cmd.Context(), codersdk.CreateFirstUserRequest{
166-
Email: email,
167-
Username: username,
168-
OrganizationName: username,
169-
Password: password,
166+
Email: email,
167+
Username: username,
168+
Password: password,
170169
})
171170
if err != nil {
172171
return xerrors.Errorf("create initial user: %w", err)

cli/resetpassword_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ func TestResetPassword(t *testing.T) {
6060
client := codersdk.New(accessURL)
6161

6262
_, err = client.CreateFirstUser(ctx, codersdk.CreateFirstUserRequest{
63-
Email: email,
64-
Username: username,
65-
Password: oldPassword,
66-
OrganizationName: "example",
63+
Email: email,
64+
Username: username,
65+
Password: oldPassword,
6766
})
6867
require.NoError(t, err)
6968

cli/server_test.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@ func TestServer(t *testing.T) {
7171
client := codersdk.New(accessURL)
7272

7373
_, err = client.CreateFirstUser(ctx, codersdk.CreateFirstUserRequest{
74-
Email: "some@one.com",
75-
Username: "example",
76-
Password: "password",
77-
OrganizationName: "example",
74+
Email: "some@one.com",
75+
Username: "example",
76+
Password: "password",
7877
})
7978
require.NoError(t, err)
8079
cancelFunc()

coderd/coderdtest/coderdtest.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -346,10 +346,9 @@ func NewProvisionerDaemon(t *testing.T, coderAPI *coderd.API) io.Closer {
346346
}
347347

348348
var FirstUserParams = codersdk.CreateFirstUserRequest{
349-
Email: "testuser@coder.com",
350-
Username: "testuser",
351-
Password: "testpass",
352-
OrganizationName: "testorg",
349+
Email: "testuser@coder.com",
350+
Username: "testuser",
351+
Password: "testpass",
353352
}
354353

355354
// CreateFirstUser creates a user with preset credentials and authenticates

coderd/users_test.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,9 @@ func TestFirstUser(t *testing.T) {
4949
defer cancel()
5050

5151
_, err := client.CreateFirstUser(ctx, codersdk.CreateFirstUserRequest{
52-
Email: "some@email.com",
53-
Username: "exampleuser",
54-
Password: "password",
55-
OrganizationName: "someorg",
52+
Email: "some@email.com",
53+
Username: "exampleuser",
54+
Password: "password",
5655
})
5756
var apiErr *codersdk.Error
5857
require.ErrorAs(t, err, &apiErr)
@@ -249,10 +248,9 @@ func TestPostLogin(t *testing.T) {
249248
defer cancel()
250249

251250
req := codersdk.CreateFirstUserRequest{
252-
Email: "testuser@coder.com",
253-
Username: "testuser",
254-
Password: "testpass",
255-
OrganizationName: "testorg",
251+
Email: "testuser@coder.com",
252+
Username: "testuser",
253+
Password: "testpass",
256254
}
257255
_, err := client.CreateFirstUser(ctx, req)
258256
require.NoError(t, err)

codersdk/users.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,9 @@ type UserCountResponse struct {
6262
}
6363

6464
type CreateFirstUserRequest struct {
65-
Email string `json:"email" validate:"required,email"`
66-
Username string `json:"username" validate:"required,username"`
67-
Password string `json:"password" validate:"required"`
68-
OrganizationName string `json:"organization" validate:"required,username"`
65+
Email string `json:"email" validate:"required,email"`
66+
Username string `json:"username" validate:"required,username"`
67+
Password string `json:"password" validate:"required"`
6968
}
7069

7170
// CreateFirstUserResponse contains IDs for newly created user info.

site/src/api/typesGenerated.ts

-1
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export interface CreateFirstUserRequest {
143143
readonly email: string
144144
readonly username: string
145145
readonly password: string
146-
readonly organization: string
147146
}
148147

149148
// From codersdk/users.go

site/src/pages/SetupPage/SetupPage.test.tsx

-6
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,14 @@ const fillForm = async ({
1212
username = "someuser",
1313
email = "someone@coder.com",
1414
password = "password",
15-
organization = "Coder",
1615
}: {
1716
username?: string
1817
email?: string
1918
password?: string
20-
organization?: string
2119
} = {}) => {
2220
const usernameField = screen.getByLabelText(PageViewLanguage.usernameLabel)
2321
const emailField = screen.getByLabelText(PageViewLanguage.emailLabel)
2422
const passwordField = screen.getByLabelText(PageViewLanguage.passwordLabel)
25-
const organizationField = screen.getByLabelText(
26-
PageViewLanguage.organizationLabel,
27-
)
28-
await userEvent.type(organizationField, organization)
2923
await userEvent.type(usernameField, username)
3024
await userEvent.type(emailField, email)
3125
await userEvent.type(passwordField, password)

site/src/pages/SetupPage/SetupPageView.tsx

-12
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ export const Language = {
1313
emailLabel: "Email",
1414
passwordLabel: "Password",
1515
usernameLabel: "Username",
16-
organizationLabel: "Organization name",
1716
emailInvalid: "Please enter a valid email address.",
1817
emailRequired: "Please enter an email address.",
1918
passwordRequired: "Please enter a password.",
20-
organizationRequired: "Please enter an organization name.",
2119
create: "Setup account",
2220
welcomeMessage: (
2321
<>
@@ -32,7 +30,6 @@ const validationSchema = Yup.object({
3230
.email(Language.emailInvalid)
3331
.required(Language.emailRequired),
3432
password: Yup.string().required(Language.passwordRequired),
35-
organization: Yup.string().required(Language.organizationRequired),
3633
username: nameValidator(Language.usernameLabel),
3734
})
3835

@@ -55,7 +52,6 @@ export const SetupPageView: React.FC<SetupPageViewProps> = ({
5552
email: "",
5653
password: "",
5754
username: "",
58-
organization: "",
5955
},
6056
validationSchema,
6157
onSubmit,
@@ -70,14 +66,6 @@ export const SetupPageView: React.FC<SetupPageViewProps> = ({
7066
<Welcome message={Language.welcomeMessage} />
7167
<form onSubmit={form.handleSubmit}>
7268
<Stack>
73-
<TextField
74-
{...getFieldHelpers("organization")}
75-
onChange={onChangeTrimmed(form)}
76-
autoFocus
77-
fullWidth
78-
label={Language.organizationLabel}
79-
variant="outlined"
80-
/>
8169
<TextField
8270
{...getFieldHelpers("username")}
8371
onChange={onChangeTrimmed(form)}

0 commit comments

Comments
 (0)