Skip to content

Commit

Permalink
slugify the github login when creating account for github auth #207
Browse files Browse the repository at this point in the history
  • Loading branch information
leafo committed Feb 28, 2025
1 parent a38bf63 commit ebab235
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion applications/github.moon
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ class MoonrocksGithub extends lapis.Application
username = Users\generate_username(github_user.login)
user = Users\create(username, nil, email, github_user.login)

import slugify from require "lapis.util"

-- try to claim the username
db.update Users\table_name!, {
username: github_user.login
slug: github_user.login
slug: slugify github_user.login
}, "id = ? and not exists(select 1 from users where username = ?)", user.id, github_user.login

account_data.user_id = user.id
Expand Down

0 comments on commit ebab235

Please sign in to comment.