Skip to content

Commit 74f2771

Browse files
authored
feat: specify a custom "terms of service" link (#13068)
1 parent 341114a commit 74f2771

File tree

19 files changed

+131
-16
lines changed

19 files changed

+131
-16
lines changed

cli/testdata/coder_server_--help.golden

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ OPTIONS:
6060
--support-links struct[[]codersdk.LinkConfig], $CODER_SUPPORT_LINKS
6161
Support links to display in the top right drop down menu.
6262

63+
--terms-of-service-url string, $CODER_TERMS_OF_SERVICE_URL
64+
A URL to an external Terms of Service that must be accepted by users
65+
when logging in.
66+
6367
--update-check bool, $CODER_UPDATE_CHECK (default: false)
6468
Periodically check for new releases of Coder and inform the owner. The
6569
check is performed once per day.

cli/testdata/server-config.yaml.golden

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,10 @@ inMemoryDatabase: false
414414
# Type of auth to use when connecting to postgres.
415415
# (default: password, type: enum[password\|awsiamrds])
416416
pgAuth: password
417+
# A URL to an external Terms of Service that must be accepted by users when
418+
# logging in.
419+
# (default: <unset>, type: string)
420+
termsOfServiceURL: ""
417421
# The algorithm to use for generating ssh keys. Accepted values are "ed25519",
418422
# "ecdsa", or "rsa4096".
419423
# (default: ed25519, type: string)

coderd/apidoc/docs.go

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/userauth.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ func (api *API) userAuthMethods(rw http.ResponseWriter, r *http.Request) {
472472
}
473473

474474
httpapi.Write(r.Context(), rw, http.StatusOK, codersdk.AuthMethods{
475+
TermsOfServiceURL: api.DeploymentValues.TermsOfServiceURL.Value(),
475476
Password: codersdk.AuthMethod{
476477
Enabled: !api.DeploymentValues.DisablePasswordAuth.Value(),
477478
},

codersdk/deployment.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ type DeploymentValues struct {
200200
AllowWorkspaceRenames serpent.Bool `json:"allow_workspace_renames,omitempty" typescript:",notnull"`
201201
Healthcheck HealthcheckConfig `json:"healthcheck,omitempty" typescript:",notnull"`
202202
CLIUpgradeMessage serpent.String `json:"cli_upgrade_message,omitempty" typescript:",notnull"`
203+
TermsOfServiceURL serpent.String `json:"terms_of_service_url,omitempty" typescript:",notnull"`
203204

204205
Config serpent.YAMLConfigPath `json:"config,omitempty" typescript:",notnull"`
205206
WriteConfig serpent.Bool `json:"write_config,omitempty" typescript:",notnull"`
@@ -1683,6 +1684,14 @@ when required by your organization's security policy.`,
16831684
YAML: "secureAuthCookie",
16841685
Annotations: serpent.Annotations{}.Mark(annotationExternalProxies, "true"),
16851686
},
1687+
{
1688+
Name: "Terms of Service URL",
1689+
Description: "A URL to an external Terms of Service that must be accepted by users when logging in.",
1690+
Flag: "terms-of-service-url",
1691+
Env: "CODER_TERMS_OF_SERVICE_URL",
1692+
YAML: "termsOfServiceURL",
1693+
Value: &c.TermsOfServiceURL,
1694+
},
16861695
{
16871696
Name: "Strict-Transport-Security",
16881697
Description: "Controls if the 'Strict-Transport-Security' header is set on all static file responses. " +

codersdk/users.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,10 @@ type CreateOrganizationRequest struct {
209209

210210
// AuthMethods contains authentication method information like whether they are enabled or not or custom text, etc.
211211
type AuthMethods struct {
212-
Password AuthMethod `json:"password"`
213-
Github AuthMethod `json:"github"`
214-
OIDC OIDCAuthMethod `json:"oidc"`
212+
TermsOfServiceURL string `json:"terms_of_service_url,omitempty"`
213+
Password AuthMethod `json:"password"`
214+
Github AuthMethod `json:"github"`
215+
OIDC OIDCAuthMethod `json:"oidc"`
215216
}
216217

217218
type AuthMethod struct {

docs/api/general.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/schemas.md

Lines changed: 11 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/api/users.md

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)