Skip to content

Commit c1b55e2

Browse files
feat: add customizable signups disabled text for all authentication methods
This change adds a general --signups-disabled-text configuration option that allows administrators to customize the message shown when signups are disabled, regardless of the authentication method used. Changes: - Add SignupsDisabledText field to DeploymentValues struct - Add --signups-disabled-text CLI flag and CODER_SIGNUPS_DISABLED_TEXT env var - Update userauth logic to use general text with OIDC fallback for backward compatibility - Add new User Authentication deployment group for general auth settings - Support Markdown formatting in the custom text This enhances the existing OIDC-specific signups disabled text to work with all authentication methods, providing better flexibility for administrators to inform users about signup policies. Co-authored-by: kylecarbs <7122116+kylecarbs@users.noreply.github.com>
1 parent e76115c commit c1b55e2

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

cli/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ func (r *RootCmd) Server(newAPI func(context.Context, *coderd.Options) (*coderd.
641641
ExternalAuthConfigs: externalAuthConfigs,
642642
RealIPConfig: realIPConfig,
643643
SSHKeygenAlgorithm: sshKeygenAlgorithm,
644+
SignupsDisabledText: vals.SignupsDisabledText.String(),
644645
TracerProvider: tracerProvider,
645646
Telemetry: telemetry.NewNoop(),
646647
MetricsCacheRefreshInterval: vals.MetricsCacheRefreshInterval.Value(),

coderd/coderd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ type Options struct {
167167
PrometheusRegistry *prometheus.Registry
168168
StrictTransportSecurityCfg httpmw.HSTSConfig
169169
SSHKeygenAlgorithm gitsshkey.Algorithm
170+
SignupsDisabledText string
170171
Telemetry telemetry.Reporter
171172
TracerProvider trace.TracerProvider
172173
ExternalAuthConfigs []*externalauth.Config

coderd/userauth.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,11 @@ func (api *API) oauthLogin(r *http.Request, params *oauthLoginParams) ([]*http.C
16821682

16831683
if user.ID == uuid.Nil && !allowSignup {
16841684
signupsDisabledText := "Please contact your Coder administrator to request access."
1685-
if api.OIDCConfig != nil && api.OIDCConfig.SignupsDisabledText != "" {
1685+
// Use general signups disabled text if configured
1686+
if api.SignupsDisabledText != "" {
1687+
signupsDisabledText = render.HTMLFromMarkdown(api.SignupsDisabledText)
1688+
} else if api.OIDCConfig != nil && api.OIDCConfig.SignupsDisabledText != "" {
1689+
// Fallback to OIDC-specific text for backward compatibility
16861690
signupsDisabledText = render.HTMLFromMarkdown(api.OIDCConfig.SignupsDisabledText)
16871691
}
16881692
return &idpsync.HTTPError{

codersdk/deployment.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ type DeploymentValues struct {
366366
Trace TraceConfig `json:"trace,omitempty" typescript:",notnull"`
367367
HTTPCookies HTTPCookieConfig `json:"http_cookies,omitempty" typescript:",notnull"`
368368
StrictTransportSecurity serpent.Int64 `json:"strict_transport_security,omitempty" typescript:",notnull"`
369+
SignupsDisabledText serpent.String `json:"signups_disabled_text,omitempty" typescript:",notnull"`
369370
StrictTransportSecurityOptions serpent.StringArray `json:"strict_transport_security_options,omitempty" typescript:",notnull"`
370371
SSHKeygenAlgorithm serpent.String `json:"ssh_keygen_algorithm,omitempty" typescript:",notnull"`
371372
MetricsCacheRefreshInterval serpent.Duration `json:"metrics_cache_refresh_interval,omitempty" typescript:",notnull"`
@@ -974,6 +975,11 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
974975
Name: "OIDC",
975976
YAML: "oidc",
976977
}
978+
deploymentGroupUserAuth = serpent.Group{
979+
Name: "User Authentication",
980+
Description: "Configure general user authentication and signup settings.",
981+
YAML: "userAuth",
982+
}
977983
deploymentGroupTelemetry = serpent.Group{
978984
Name: "Telemetry",
979985
YAML: "telemetry",
@@ -2494,6 +2500,15 @@ func (c *DeploymentValues) Options() serpent.OptionSet {
24942500
Value: &c.SSHKeygenAlgorithm,
24952501
YAML: "sshKeygenAlgorithm",
24962502
},
2503+
{
2504+
Name: "Signups Disabled Text",
2505+
Description: "The custom text to show on the error page when signups are disabled. Markdown format is supported.",
2506+
Flag: "signups-disabled-text",
2507+
Env: "CODER_SIGNUPS_DISABLED_TEXT",
2508+
Value: &c.SignupsDisabledText,
2509+
Group: &deploymentGroupUserAuth,
2510+
YAML: "signupsDisabledText",
2511+
},
24972512
{
24982513
Name: "Metrics Cache Refresh Interval",
24992514
Description: "How frequently metrics are refreshed.",

0 commit comments

Comments
 (0)