Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replaces periods in email with underscores when creating a username. #351

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/auth/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default async function authorize(
identity.email
?.substring(0, identity.email?.indexOf("@"))
.replace(/[^a-zA-Z._]/g, "_")
.replace(/__/g, "_") ||
.replace(/__/g, "_")
.replace(/\./g, "_") ||
Copy link
Member

@koistya koistya Aug 16, 2022

Choose a reason for hiding this comment

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

@njhargis if you'd like to exclude dot characters from usernames, removing it from line 50 above might be a better tweak /[^a-zA-Z._]/g => /[^a-z0-9_]/gi.

Though, if usernames can support dot characters, that might be better for end users, similarly to Instagram usernames, where you can have usernames such as @site.com.

id;
const usernameAvailable = await db
.table<User>("user")
Expand Down