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

Allow specifying a default login slug #8058

Merged
merged 1 commit into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions enterprise/app/login/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ export default class LoginComponent extends React.Component<Props, State> {
}

isOrgSpecific() {
return this.isJoiningOrg() || capabilities.config.customerSubdomain;
return this.isJoiningOrg() || capabilities.config.defaultLoginSlug || capabilities.config.customerSubdomain;
}

getUrlSlug() {
if (this.isJoiningOrg()) {
return window.location.pathname.split("/").pop();
}
if (this.isOrgSpecific()) {
if (this.isOrgSpecific() && capabilities.config.customerSubdomain) {
return window.location.host.split(".")[0];
}
return "";
return capabilities.config.defaultLoginSlug;
}

async fetchOrgName() {
Expand Down
3 changes: 3 additions & 0 deletions proto/config.proto
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ message FrontendConfig {

// Whether the community links is enabled in the UI.
bool community_links_enabled = 58;

// If set, the login page will default to using this slug.
string default_login_slug = 59;
}

message Region {
Expand Down
2 changes: 2 additions & 0 deletions server/static/static.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ var (
targetFlakesUIEnabled = flag.Bool("app.target_flakes_ui_enabled", false, "If set, show some fancy new features for analyzing flakes.")
bazelButtonsEnabled = flag.Bool("app.bazel_buttons_enabled", false, "If set, show remote bazel buttons in the UI.")
communityLinksEnabled = flag.Bool("app.community_links_enabled", true, "If set, show links to BuildBuddy community in the UI.")
defaultLoginSlug = flag.String("app.default_login_slug", "", "If set, the login page will default to using this slug.")

jsEntryPointPath = flag.String("js_entry_point_path", "/app/app_bundle/app.js?hash={APP_BUNDLE_HASH}", "Absolute URL path of the app JS entry point")
disableGA = flag.Bool("disable_ga", false, "If true; ga will be disabled")
Expand Down Expand Up @@ -214,6 +215,7 @@ func serveIndexTemplate(ctx context.Context, env environment.Env, tpl *template.
BazelButtonsEnabled: *bazelButtonsEnabled,
CspNonce: nonce,
CommunityLinksEnabled: *communityLinksEnabled,
DefaultLoginSlug: *defaultLoginSlug,
}

configJSON, err := protojson.Marshal(&config)
Expand Down
Loading