Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: implement sign up with GitHub for the first user#16629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
hugodutka merged 4 commits intomainfromhugodutka/github-oauth2-setup
Feb 25, 2025

Conversation

hugodutka
Copy link
Contributor

@hugodutkahugodutka commentedFeb 19, 2025
edited
Loading

Second PR to address#16230. See the issue for more context and discussion.

It adds a "Continue with GitHub" button to the/setup page, so the deployment's admin can sign up with it. It also removes the "Username" and "Full Name" fields to make signing up with email faster. In the email flow, the username is now auto-generated based on the email, and full name is left empty.

Screenshot 2025-02-21 at 17 51 22

There's a separate, follow up issue to visually align the/setup page with the new design system:#16653

MrPeacockNLB reacted with hooray emoji
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch 3 times, most recently from5fb6932 toa4258c7CompareFebruary 20, 2025 16:16
@hugodutkahugodutka changed the titlefeat: first user sign up with githubfeat: implement sign up with GitHub for the first userFeb 20, 2025
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch 13 times, most recently fromb16682c to2473a5eCompareFebruary 21, 2025 16:19
@hugodutkahugodutka marked this pull request as ready for reviewFebruary 21, 2025 16:57
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-device-flow branch fromdab3105 tobe8cca1CompareFebruary 21, 2025 17:18
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch from2473a5e to1055883CompareFebruary 21, 2025 17:19
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-device-flow branch frombe8cca1 tocfc3645CompareFebruary 21, 2025 17:23
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch from1055883 to484afd4CompareFebruary 21, 2025 17:23
Base automatically changed fromhugodutka/github-oauth2-device-flow tomainFebruary 21, 2025 17:42
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch from484afd4 to9549df5CompareFebruary 21, 2025 17:44
@hugodutka
Copy link
ContributorAuthor

By the way, you can test the changes locally by starting the coder server like this:

export CODER_OAUTH2_GITHUB_DEVICE_FLOW=trueexport CODER_OAUTH2_GITHUB_CLIENT_ID=Iv23liSBHklRMBNx5lk9export CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=truego run cmd/coder/main.go server

@dannykopping
Copy link
Contributor

By the way, you can test the changes locally by starting the coder server like this:

export CODER_OAUTH2_GITHUB_DEVICE_FLOW=trueexport CODER_OAUTH2_GITHUB_CLIENT_ID=Iv23liSBHklRMBNx5lk9export CODER_OAUTH2_GITHUB_ALLOW_EVERYONE=truego run cmd/coder/main.go server

PSgo run cmd/coder/main.go server only produces a slim build, so the web UI doesn't work.

Once I get a full build running and auth with your client ID I get:

image

@dannykopping
Copy link
Contributor

I tested usingscripts/develop.sh which creates the first user; maybe that caused an issue?

@hugodutka
Copy link
ContributorAuthor

@dannykopping yes - only the first user can be created by default. This matches how Coder works currently.

Tu usego run as I mentioned above you’d have to also start the frontend separately:

cd site && pnpm run dev

@dannykopping
Copy link
Contributor

Sweet 👌 works nicely

Copy link
Member

@EmyrkEmyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM, I did not test it though

@@ -198,6 +200,7 @@ func (api *API) postFirstUser(rw http.ResponseWriter, r *http.Request) {
OrganizationIDs: []uuid.UUID{defaultOrg.ID},
},
LoginType: database.LoginTypePassword,
RBACRoles: []string{rbac.RoleOwner().String()},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

❤️

onChangeTrimmed(form)(event);
},
[form],
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

IMO, there is no need to useuseCallback since the function is not used as a dependency in an effect and the function doesn't look heavy for optimization.

https://www.joshwcomeau.com/react/usememo-and-usecallback/

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

moved it out ofuseCallback

<div className="shrink-0 text-xs uppercase text-content-secondary tracking-wider">
or
</div>
<div className="h-[1px] w-full bg-divider" />
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We don't use the token divider so you could usebg-border-default. Let me know in case it does not look good.

Copy link
ContributorAuthor

@hugodutkahugodutkaFeb 24, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I added support for the divider token to mirror the color palette of the sign in screen exactly. Would you like me to remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Yes please, since we don't use it in our design system.

hugodutka reacted with thumbs up emoji
Copy link
ContributorAuthor

@hugodutkahugodutkaFeb 24, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

done!bg-border-default isn't valid, butbg-border is and it looks good.
Screenshot 2025-02-24 at 17 54 59

@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch 2 times, most recently from1a67ae7 todfd49d0CompareFebruary 24, 2025 16:59
@hugodutkahugodutkaforce-pushed thehugodutka/github-oauth2-setup branch fromdfd49d0 to3b36025CompareFebruary 24, 2025 20:37
@hugodutkahugodutka merged commit67d89bb intomainFeb 25, 2025
31 of 33 checks passed
@hugodutkahugodutka deleted the hugodutka/github-oauth2-setup branchFebruary 25, 2025 14:54
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsFeb 25, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@BrunoQuaresmaBrunoQuaresmaBrunoQuaresma approved these changes

@EmyrkEmyrkEmyrk approved these changes

Assignees

@hugodutkahugodutka

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@hugodutka@dannykopping@BrunoQuaresma@Emyrk

[8]ページ先頭

©2009-2025 Movatter.jp