Skip to content

Commit

Permalink
fix: disallow common email domains in selector
Browse files Browse the repository at this point in the history
  • Loading branch information
nikochiko committed Mar 5, 2025
1 parent 4e5ce60 commit a6d7313
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion workspaces/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ def render_workspace_edit_form(
domain_name_options = get_workspace_domain_name_options(
workspace=workspace, current_user=current_user
)
if len(domain_name_options) > 1:
if domain_name_options:
workspace.domain_name = gui.selectbox(
"###### Domain Name _(Optional)_",
options=domain_name_options,
Expand Down
8 changes: 4 additions & 4 deletions workspaces/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,11 +384,11 @@ def get_workspace_domain_name_options(
workspace: Workspace, current_user: AppUser
) -> set | None:
current_user_domain = (
current_user.email
and current_user.email not in COMMON_EMAIL_DOMAINS
and current_user.email.rsplit("@", maxsplit=1)[-1]
current_user.email and current_user.email.lower().rsplit("@", maxsplit=1)[-1]
)
options = {workspace.domain_name, current_user_domain, None}
options = {workspace.domain_name, None}
if current_user_domain not in COMMON_EMAIL_DOMAINS:
options.add(current_user_domain)
return len(options) > 1 and options or None


Expand Down

0 comments on commit a6d7313

Please sign in to comment.