Skip to content

feat: add customizable signups disabled text for all authentication methods #18887

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions cli/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
ExternalAuthConfigs: externalAuthConfigs,
RealIPConfig: realIPConfig,
SSHKeygenAlgorithm: sshKeygenAlgorithm,
SignupsDisabledText: vals.SignupsDisabledText.String(),
TracerProvider: tracerProvider,
Telemetry: telemetry.NewNoop(),
MetricsCacheRefreshInterval: vals.MetricsCacheRefreshInterval.Value(),
Expand Down
1 change: 1 addition & 0 deletions coderd/coderd.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ type Options struct {
PrometheusRegistry *prometheus.Registry
StrictTransportSecurityCfg httpmw.HSTSConfig
SSHKeygenAlgorithm gitsshkey.Algorithm
SignupsDisabledText string
Telemetry telemetry.Reporter
TracerProvider trace.TracerProvider
ExternalAuthConfigs []*externalauth.Config
Expand Down
6 changes: 5 additions & 1 deletion coderd/userauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1682,7 +1682,11 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C

if user.ID == uuid.Nil && !allowSignup {
signupsDisabledText := "Please contact your Coder administrator to request access."
if api.OIDCConfig != nil && api.OIDCConfig.SignupsDisabledText != "" {
// Use general signups disabled text if configured
if api.SignupsDisabledText != "" {
signupsDisabledText = render.HTMLFromMarkdown(api.SignupsDisabledText)
} else if api.OIDCConfig != nil && api.OIDCConfig.SignupsDisabledText != "" {
// Fallback to OIDC-specific text for backward compatibility
signupsDisabledText = render.HTMLFromMarkdown(api.OIDCConfig.SignupsDisabledText)
}
return &idpsync.HTTPError{
Expand Down
15 changes: 15 additions & 0 deletions codersdk/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ type DeploymentValues struct {
Trace TraceConfig `json:"trace,omitempty" typescript:",notnull"`
HTTPCookies HTTPCookieConfig `json:"http_cookies,omitempty" typescript:",notnull"`
StrictTransportSecurity serpent.Int64 `json:"strict_transport_security,omitempty" typescript:",notnull"`
SignupsDisabledText serpent.String `json:"signups_disabled_text,omitempty" typescript:",notnull"`
StrictTransportSecurityOptions serpent.StringArray `json:"strict_transport_security_options,omitempty" typescript:",notnull"`
SSHKeygenAlgorithm serpent.String `json:"ssh_keygen_algorithm,omitempty" typescript:",notnull"`
MetricsCacheRefreshInterval serpent.Duration `json:"metrics_cache_refresh_interval,omitempty" typescript:",notnull"`
Expand Down Expand Up @@ -974,6 +975,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
Name: "OIDC",
YAML: "oidc",
}
deploymentGroupUserAuth = serpent.Group{
Name: "User Authentication",
Description: "Configure general user authentication and signup settings.",
YAML: "userAuth",
}
deploymentGroupTelemetry = serpent.Group{
Name: "Telemetry",
YAML: "telemetry",
Expand Down Expand Up @@ -2494,6 +2500,15 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
Value: &c.SSHKeygenAlgorithm,
YAML: "sshKeygenAlgorithm",
},
{
Name: "Signups Disabled Text",
Description: "The custom text to show on the error page when signups are disabled. Markdown format is supported.",
Flag: "signups-disabled-text",
Env: "CODER_SIGNUPS_DISABLED_TEXT",
Value: &c.SignupsDisabledText,
Group: &deploymentGroupUserAuth,
YAML: "signupsDisabledText",
},
{
Name: "Metrics Cache Refresh Interval",
Description: "How frequently metrics are refreshed.",
Expand Down
10 changes: 10 additions & 0 deletions docs/reference/cli/server.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions enterprise/cli/testdata/coder_server_--help.golden
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,13 @@ when required by your organization's security policy.
Whether telemetry is enabled or not. Coder collects anonymized usage
data to help improve our product.

USER AUTHENTICATION OPTIONS:
Configure general user authentication and signup settings.

--signups-disabled-text string, $CODER_SIGNUPS_DISABLED_TEXT
The custom text to show on the error page when signups are disabled.
Markdown format is supported.

USER QUIET HOURS SCHEDULE OPTIONS:
Allow users to set quiet hours schedules each day for workspaces to avoid
workspaces stopping during the day due to template scheduling.
Expand Down
1 change: 1 addition & 0 deletions site/src/api/typesGenerated.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading