You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6f72928
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: CHANGELOG.md
+11Lines changed: 11 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,17 @@ All notable changes to this project are documented in this file. The format is b
19
19
- Core: `warn_ignored_env_vars` (invoked automatically at boot by `ModuleSettingsRegistry.register` for `DbBackedSettings` subclasses) logs one warning per leftover `SM_<MODULE>_*` environment variable without logging its value, naming the DB setting to configure instead (#1329).
20
20
- Hosting: `HostSettings.csp_frame_src` (`SM_CSP_FRAME_SRC`, live runtime setting accepting a JSON array or comma-separated origins) allows permitting external iframe embed origins in CSP `frame-src` (`'self' blob: <origins>`) without weakening `script-src` or `default-src` (#1331).
21
21
- Inertia / Hosting: `HostSettings.inertia_encrypt_history` (`SM_INERTIA_ENCRYPT_HISTORY`, default `true`, live runtime setting), `InertiaConfig.encrypt_history`, `inertia.encrypt_history(enabled=...)`, and per-response `inertia.render(..., encrypt_history=True|False|None)` allow opting out of (or back into) Inertia history encryption host-wide or per page, with `history.state` guidance added to `docs/frontend/inertia.md` (#1334).
22
+
- Users: add `oauth_microsoft_display_name` (default `"Microsoft"`) on `UsersSettings` so apps can customize the Microsoft sign-in button label, matching `oauth_oidc_display_name` (#1338).
23
+
- Branding / Users / UI: let apps brand the stock login page without overriding it — add optional `login_heading` and `login_tagline` fields to `BrandingSettings` (shared as `branding.loginHeading` / `branding.loginTagline` and editable at `/admin/branding` and per tenant), add a `LoginAside` layout override on `LayoutComponents` (`registry.registerLayout('LoginAside', ...)`), and export `LoginForm`, `WaitingOnYou`, `DemoSignIn`, `useLoginState`, and `signIn` from `@simple-module-py/users/ui` (`modules/users/users/ui/index.ts`) (#1340).
24
+
25
+
### Changed
26
+
27
+
- Users: **Behaviour change:** OAuth signups under `allow_signup` (for providers not in `oauth_signup_providers`) now receive `signup_default_role` instead of the hard-coded `user` role, matching local self-signup (#1332).
28
+
29
+
### Fixed
30
+
31
+
- Users: validate `oauth_trusted_email_domains` entries in `normalize_domain` as bare DNS hostnames after IDNA encoding, rejecting URLs, paths, ports, queries, fragments, whitespace, empty labels, leading/trailing hyphens, and oversized labels/domains (#1336).
32
+
- Users: mark OAuth provider links in `LoginForm` with `data-native-link` so `startSpaLinkInterception` does not intercept provider redirects as Inertia XHRs and trigger CSP `connect-src 'self'` errors (#1339).
`PUT /` only touches the text fields (`app_name`, `primary_color`, `design_pack`, `banner_message`, `banner_severity`); images are set and cleared through their dedicated upload/delete routes. A `design_pack` slug that no installed module registered is rejected with `422` — accepting it would put `"<slug>-root"` on the document with no stylesheet behind it, so the site would look unchanged with nothing in the UI explaining why.
45
+
`PUT /` only touches the text fields (`app_name`, `primary_color`, `design_pack`, `banner_message`, `banner_severity`, `footer_text`, `footer_links`, `login_heading`, `login_tagline`); images are set and cleared through their dedicated upload/delete routes. A `design_pack` slug that no installed module registered is rejected with `422` — accepting it would put `"<slug>-root"` on the document with no stylesheet behind it, so the site would look unchanged with nothing in the UI explaining why.
46
46
47
47
### API (tenant)
48
48
@@ -132,8 +132,8 @@ from branding.contracts import BrandingOut, BrandingUpdate
132
132
133
133
| Class | Purpose |
134
134
|---|---|
135
-
|`BrandingOut`| Current branding with images resolved to URLs: `app_name`, `primary_color`, `design_pack`, `logo_url`, `logo_dark_url`, `favicon_url`, `banner_message`, `banner_severity`. |
136
-
|`BrandingUpdate`| Editable text fields, all optional: `app_name`, `primary_color`, `design_pack`, `banner_message`, `banner_severity`. |
135
+
|`BrandingOut`| Current branding with images resolved to URLs: `app_name`, `primary_color`, `design_pack`, `logo_url`, `logo_dark_url`, `favicon_url`, `banner_message`, `banner_severity`, `footer_text`, `footer_links`, `login_heading`, `login_tagline`. |
136
+
|`BrandingUpdate`| Editable text fields, all optional: `app_name`, `primary_color`, `design_pack`, `banner_message`, `banner_severity`, `footer_text`, `footer_links`, `login_heading`, `login_tagline`. |
137
137
138
138
`BrandingUpdate` is the strict one. An unknown `banner_severity` is a clear `422` here, while the settings validator normalises it to `info` — settings hydrate from the DB, where a hand-edited row must degrade to a readable banner rather than stop the app from booting. `design_pack` and `primary_color` are shape-checked in the DTO for the same reason: a malformed value becomes a `422` instead of a `500` when `BrandingSettings` re-validates.
139
139
@@ -156,6 +156,8 @@ DB-backed via `register_module_settings`; pydantic defaults seed at boot. Edited
156
156
|`banner_message`|`""`| Site-wide announcement text (≤ 500 chars); `""` ⇒ no banner. |
157
157
|`banner_severity`|`"info"`| One of `info`, `warning`, `danger`. Unknown values normalise to `info`. |
158
158
|`footer_links`|`[]`| Up to 6 `{label, href}` links shown in the site footer; `[]` ⇒ show the framework's own links. |
159
+
|`login_heading`|`""`| Optional login split-aside heading (≤ 120 chars, no control characters); `""` ⇒ login page uses its default i18n copy. |
160
+
|`login_tagline`|`""`| Optional login split-aside tagline (≤ 300 chars, no control characters); `""` ⇒ login page uses its default i18n copy. |
159
161
160
162
`app_name` rejects control characters, not just blanks: the name is used in HTML titles and — critically — email `Subject` headers, where an embedded CR/LF would survive a bare `strip()` and then raise, breaking every transactional email.
161
163
@@ -235,20 +237,25 @@ On startup the module registers a shared-props provider (`register_inertia_share
"loginTagline": "Sign in with your workspace account."
239
243
}
240
244
}
241
245
```
242
246
243
-
`primaryColor`and `designPack` are `null` when unset; the three image URLs are `null` when no file is configured. `banner` is `null` when no message is set, so the frontend renders nothing at all rather than an empty bar. `footerLinks` is `null` when none are configured, which is what tells the frontend to keep the framework's own links rather than render an empty row.
247
+
`primaryColor`, `designPack`, `loginHeading`, and `loginTagline` are `null` when unset; the three image URLs are `null` when no file is configured. `banner` is `null` when no message is set, so the frontend renders nothing at all rather than an empty bar. `footerLinks` is `null` when none are configured, which is what tells the frontend to keep the framework's own links rather than render an empty row.
244
248
245
249
The provider is defensive — it returns `{}` if branding state isn't mounted yet, so a half-booted app never errors a render. Because changes go through the settings store, a save hot-reloads `app.state.branding.settings`; the next render reflects the new values without a restart.
246
250
247
251
## Per-tenant branding
248
252
249
253
With `multi_tenant` on, a tenant can override part of the theme for itself
250
-
(#373): `app_name`, `primary_color`, `design_pack`, `footer_text` and the three
251
-
images. Each is a settings key (`branding.<field>`) declared
Copy file name to clipboardExpand all lines: docs/modules/users.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -196,7 +196,7 @@ Edit the remaining settings under Users at `/admin/settings/`:
196
196
| Field | Default |
197
197
|---|---|
198
198
|`allow_signup`|`False`|
199
-
|`signup_default_role`|`"user"` — existing role for local self-signup; blank or a missing role grants none |
199
+
|`signup_default_role`|`"user"` — existing role for local self-signup and OAuth signups under `allow_signup` (when the provider is not in `oauth_signup_providers`); blank or a missing role grants none |
|`oauth_microsoft_client_id` / `oauth_microsoft_client_secret` / `oauth_microsoft_tenant`/ `oauth_microsoft_display_name`|`""` / `""` / `"common"`/ `"Microsoft"`— Microsoft (Entra ID); `oauth_microsoft_display_name` sets the sign-in button label|
225
225
|`oauth_microsoft_trust_tenant_upn`|`False` — treat a member's UPN (the `upn` claim, else `preferred_username`) as a verified email; only with a tenant GUID (see [Signing in pre-approved staff with Microsoft](#signing-in-pre-approved-staff-with-microsoft)) |
226
226
|`oauth_microsoft_discovery_url`|`""` — development/testing only: take Microsoft's endpoints from this discovery document, for a local IdP (see [Microsoft sign-in without Entra](#microsoft-sign-in-without-entra-development)) |
227
227
|`oauth_signup_providers` / `oauth_signup_default_role`|`[]` / `""` — providers that create accounts on first sign-in with `allow_signup` off, and the role those accounts get (see [Provisioning accounts through SSO](#provisioning-accounts-through-sso)) |
@@ -809,7 +809,15 @@ With `allow_signup` off, an OAuth sign-in for an identity nobody holds is refuse
809
809
810
810
-`oauth_signup_providers` (for example `["microsoft"]`): a first sign-in through a listed provider creates the account, as an external (SSO-only) user, when the provider proved the email. An unproven email is refused even with `allow_signup` on, so listing a provider never widens what it can do. For Microsoft that means turning on the trusted-tenant policy above; GitHub needs a verified primary email; generic OIDC needs `email_verified: true`.
811
811
-`oauth_signup_default_role`: the role those accounts get, with `allow_signup` on too: a listed provider's accounts use this setting independently of local self-signup's `signup_default_role`. Blank (the default) means none: the account signs in but holds no permissions until an admin grants a role. Every account the provider creates gets this role, so name one whose permissions you would give to anyone in that directory; `admin` is refused, and a name with no matching role is logged and grants nothing.
812
-
- Local registration (`POST /api/users/auth/register`, `/users/register`, the "Sign up" links) still follows `allow_signup` alone. Its `signup_default_role` defaults to `user`; set it to an existing role such as `labeller` to grant that role on signup. The role is looked up, never created: a missing role logs a warning and grants nothing, as with `oauth_signup_default_role`. Blank also grants none, and `admin` is refused. Configure it in the admin settings editor; it applies to new accounts, leaving existing assignments unchanged. Providers that are not listed keep the old rule: they create accounts only with `allow_signup` on, and those accounts get the `user` role.
812
+
- Local registration (`POST /api/users/auth/register`, `/users/register`, the "Sign up" links) still follows `allow_signup` alone. Its `signup_default_role` defaults to `user`; set it to an existing role such as `labeller` to grant that role on signup. The role is looked up, never created: a missing role logs a warning and grants nothing, as with `oauth_signup_default_role`. Blank also grants none, and `admin` is refused. Configure it in the admin settings editor; it applies to new accounts, leaving existing assignments unchanged. Providers that are not in `oauth_signup_providers` create accounts only with `allow_signup` on, and those accounts also receive `signup_default_role` (none when blank).
813
+
814
+
### Customising the login page
815
+
816
+
You can brand `/users/login` without replacing the page:
817
+
818
+
1.**Heading and tagline via Branding:** set `login_heading` and `login_tagline` in `/admin/branding` (or `BrandingSettings`). When set, the default `AuthSplitAside` column renders them in place of the built-in `users.login.aside_heading` / `users.login.aside_body` copy.
819
+
2.**Custom split aside via the extension registry:** register a `LoginAside` component with `registry.registerLayout('LoginAside', MyLoginAside)` in your host's extension setup (see [Frontend extension points](../frontend/extensions.md)). This replaces the left-hand column with your own illustration or layout while keeping `LoginForm`, OAuth buttons, CSRF, `oauth_error`, verification resend, and demo sign-in intact.
820
+
3.**Composing a custom login page:** when you do need to override `Users/Login`, import `LoginForm`, `WaitingOnYou`, `DemoSignIn`, `useLoginState`, and `signIn` from `@simple-module-py/users/ui` (`modules/users/users/ui/index.ts`) instead of re-implementing login state and OAuth links.
0 commit comments