Liking cljdoc? Tell your friends :D

wagoe.user.shell.web-handlers

Web UI handlers for user module.

This namespace implements Ring handlers that return HTML responses for user-related web pages, either full pages or HTMX partial updates.

Handler Categories:

  • Page Handlers: Return full HTML pages for initial browser requests
  • HTMX Handlers: Return HTML fragments for dynamic updates

All handlers use the shared UI components and user shell services.

Web UI handlers for user module.

This namespace implements Ring handlers that return HTML responses
for user-related web pages, either full pages or HTMX partial updates.

Handler Categories:
- Page Handlers: Return full HTML pages for initial browser requests
- HTMX Handlers: Return HTML fragments for dynamic updates

All handlers use the shared UI components and user shell services.
raw docstring

account-recovery-allowed?clj

(account-recovery-allowed? actor target-id)

Whether actor may unlock user target-id or reset their second factor: a platform admin, as for the audit trail, and not on their own account, whose second factor the profile turns off with a password or code.

Whether `actor` may unlock user `target-id` or reset their second factor: a
platform admin, as for the audit trail, and not on their own account, whose
second factor the profile turns off with a password or code.
sourceraw docstring

audit-page-handlerclj

(audit-page-handler user-service _config)

Handler for the audit trail page (GET /web/audit). Its own controls request this URL and push it, so the address bar holds sort, filters and page; they get the table fragment back.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for the audit trail page (GET /web/audit). Its own controls
request this URL and push it, so the address bar holds sort, filters and
page; they get the table fragment back.

Args:
  user-service: User service instance
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

audit-table-fragment-handlerclj

(audit-table-fragment-handler user-service _config)

Handler for the audit table fragment (GET /web/audit/table), for callers that ask for the table alone.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for the audit table fragment (GET /web/audit/table), for callers
that ask for the table alone.

Args:
  user-service: User service instance
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

bulk-update-users-htmx-handlerclj

(bulk-update-users-htmx-handler user-service _config)

HTMX handler for bulk user operations (POST /web/users/bulk).

Supports multiple actions: deactivate, activate, delete, role changes. Returns the updated users table fragment using the same query parameters and filters as the current view.

HTMX handler for bulk user operations (POST /web/users/bulk).

Supports multiple actions: deactivate, activate, delete, role changes.
Returns the updated users table fragment using the same query
parameters and filters as the current view.
sourceraw docstring

create-user-htmx-handlerclj

(create-user-htmx-handler user-service email-sender config)

HTMX handler for creating a new user (POST /web/users).

Validates form data and on success instructs HTMX to navigate back to the caller-provided return-to URL (validated via safe-return-url), falling back to the admin users list. Uses the HX-Redirect response header rather than injecting JavaScript so the URL value never reaches an HTML/JS context.

Args: user-service: User service instance email-sender: Optional ISmtpProvider for sending welcome emails config: Application configuration map

Returns: Ring handler function

HTMX handler for creating a new user (POST /web/users).

Validates form data and on success instructs HTMX to navigate back to the
caller-provided `return-to` URL (validated via `safe-return-url`), falling
back to the admin users list. Uses the `HX-Redirect` response header rather
than injecting JavaScript so the URL value never reaches an HTML/JS context.

Args:
  user-service: User service instance
  email-sender: Optional ISmtpProvider for sending welcome emails
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

create-user-page-handlerclj

(create-user-page-handler config)

Handler for the create user page (GET /web/users/new).

Args: config: Application configuration map

Returns: Ring handler function

Handler for the create user page (GET /web/users/new).

Args:
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

error-pageclj

(error-page request error)

The page a browser sees in place of an error body on a /web request: platform's :error-page, which this module supplies.

The page a browser sees in place of an error body on a /web request:
platform's `:error-page`, which this module supplies.
sourceraw docstring

hard-delete-user-handlerclj

(hard-delete-user-handler user-service _config)

Handler for permanently deleting a user (POST /web/users/:id/hard-delete).

⚠️ IRREVERSIBLE OPERATION - Permanently removes user and all related data. Should only be used for GDPR compliance or similar requirements. Requires admin role.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for permanently deleting a user (POST /web/users/:id/hard-delete).

⚠️  IRREVERSIBLE OPERATION - Permanently removes user and all related data.
Should only be used for GDPR compliance or similar requirements.
Requires admin role.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

html-responseclj

(html-response request html)
(html-response request html status)
(html-response request html status extra-headers)

Create HTML response map, resolving any [:t ...] i18n markers in the Hiccup tree.

Args: request: Ring request map (used to extract :i18n/t translation function) html: HTML string or Hiccup structure status: HTTP status code (optional, defaults to 200) headers: Additional headers map (optional)

Returns: Ring response map

Create HTML response map, resolving any [:t ...] i18n markers in the Hiccup tree.

Args:
  request: Ring request map (used to extract :i18n/t translation function)
  html: HTML string or Hiccup structure
  status: HTTP status code (optional, defaults to 200)
  headers: Additional headers map (optional)

Returns:
  Ring response map
sourceraw docstring

login-page-handlerclj

(login-page-handler config)

GET /web/login - render login page.

GET /web/login - render login page.
sourceraw docstring

login-submit-handlerclj

(login-submit-handler user-service config)

POST /web/login - validate credentials, authenticate, set session cookie.

POST /web/login - validate credentials, authenticate, set session cookie.
sourceraw docstring

logout-handlerclj

(logout-handler user-service _config)

POST /web/logout - clear session cookie and redirect to home.

POST /web/logout - clear session cookie and redirect to home.
sourceraw docstring

mfa-backup-codes-page-handlerclj

(mfa-backup-codes-page-handler _mfa-service config)

Handler for backup codes display page (GET /web/profile/mfa/backup-codes).

Shows backup codes after MFA enable or regeneration.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for backup codes display page (GET /web/profile/mfa/backup-codes).

Shows backup codes after MFA enable or regeneration.

Args:
  mfa-service: MFA service instance
  config: Application configuration map
  
 Returns:
  Ring handler function
sourceraw docstring

mfa-disable-handlerclj

(mfa-disable-handler mfa-service config)

Handler for MFA disable submission (POST /web/profile/mfa/disable).

Checks the password or code and disables MFA; see mfa/disable-mfa.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for MFA disable submission (POST /web/profile/mfa/disable).

Checks the password or code and disables MFA; see `mfa/disable-mfa`.

Args:
  mfa-service: MFA service instance
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

mfa-disable-page-handlerclj

(mfa-disable-page-handler _mfa-service config)

Handler for MFA disable confirmation page (GET /web/profile/mfa/disable).

Asks for the password or an authentication code.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for MFA disable confirmation page (GET /web/profile/mfa/disable).

Asks for the password or an authentication code.

Args:
  mfa-service: MFA service instance
  config: Application configuration map

 Returns:
  Ring handler function
sourceraw docstring

mfa-enrolment-page-handlerclj

(mfa-enrolment-page-handler mfa-service config)

GET /web/login/mfa-setup - the authenticator setup for a user the app requires a second factor of, who has none.

GET /web/login/mfa-setup - the authenticator setup for a user the app
requires a second factor of, who has none.
sourceraw docstring

mfa-enrolment-submit-handlerclj

(mfa-enrolment-submit-handler mfa-service config)

POST /web/login/mfa-setup - check the first code and turn the second factor on. The user then signs in with it.

POST /web/login/mfa-setup - check the first code and turn the second factor
on. The user then signs in with it.
sourceraw docstring

mfa-setup-initiate-handlerclj

(mfa-setup-initiate-handler mfa-service _config)

Handler for MFA setup initiation (POST /web/profile/mfa/setup).

HTMX handler that generates QR code and returns setup form.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for MFA setup initiation (POST /web/profile/mfa/setup).

HTMX handler that generates QR code and returns setup form.

Args:
  mfa-service: MFA service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

mfa-setup-page-handlerclj

(mfa-setup-page-handler _mfa-service config)

Handler for MFA setup page (GET /web/profile/mfa/setup).

Shows introduction and start button for MFA setup.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for MFA setup page (GET /web/profile/mfa/setup).

Shows introduction and start button for MFA setup.

Args:
  mfa-service: MFA service instance
  config: Application configuration map
  
 Returns:
  Ring handler function
sourceraw docstring

mfa-verify-handlerclj

(mfa-verify-handler mfa-service config)

Handler for MFA code verification (POST /web/profile/mfa/verify).

HTMX handler that verifies TOTP code and enables MFA.

Args: mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for MFA code verification (POST /web/profile/mfa/verify).

HTMX handler that verifies TOTP code and enables MFA.

Args:
  mfa-service: MFA service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

oidc-callback-handlerclj

(oidc-callback-handler oidc-client config)

GET /web/auth/oidc/:provider/callback - finish the sign-in.

GET /web/auth/oidc/:provider/callback - finish the sign-in.
sourceraw docstring

oidc-mfa-handlerclj

(oidc-mfa-handler oidc-client config)

POST /web/auth/oidc/mfa - the second factor after a provider sign-in.

POST /web/auth/oidc/mfa - the second factor after a provider sign-in.
sourceraw docstring

oidc-start-handlerclj

(oidc-start-handler oidc-client config)

GET /web/auth/oidc/:provider/start - send the browser to the provider.

GET /web/auth/oidc/:provider/start - send the browser to the provider.
sourceraw docstring

password-change-form-handlerclj

(password-change-form-handler _config)

Handler to show password change form (GET /web/profile/password/form).

HTMX handler that returns expanded password change card.

Args: config: Application configuration map

Returns: Ring handler function

Handler to show password change form (GET /web/profile/password/form).

HTMX handler that returns expanded password change card.

Args:
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

password-change-handlerclj

(password-change-handler user-service _config)

Handler for password change submission (POST /web/profile/password).

HTMX handler that validates and changes password.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for password change submission (POST /web/profile/password).

HTMX handler that validates and changes password.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

password-section-fragment-handlerclj

(password-section-fragment-handler _config)

Handler to show collapsed password section fragment (GET /web/profile/password).

Handler to show collapsed password section fragment (GET /web/profile/password).
sourceraw docstring

preferences-edit-form-handlerclj

(preferences-edit-form-handler user-service _config)

Handler to show preferences edit form (GET /web/profile/preferences/edit).

HTMX handler that returns the edit form fragment.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler to show preferences edit form (GET /web/profile/preferences/edit).

HTMX handler that returns the edit form fragment.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

preferences-edit-handlerclj

(preferences-edit-handler user-service _config)

Handler for preferences edit submission (POST /web/profile/preferences).

HTMX handler that updates preferences and returns updated card.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for preferences edit submission (POST /web/profile/preferences).

HTMX handler that updates preferences and returns updated card.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

preferences-fragment-handlerclj

(preferences-fragment-handler user-service _config)

Handler to return preferences card fragment (GET /web/profile/preferences).

Handler to return preferences card fragment (GET /web/profile/preferences).
sourceraw docstring

profile-edit-form-handlerclj

(profile-edit-form-handler user-service _config)

Handler to show profile edit form (GET /web/profile/edit).

HTMX handler that returns the edit form fragment.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler to show profile edit form (GET /web/profile/edit).

HTMX handler that returns the edit form fragment.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

profile-edit-handlerclj

(profile-edit-handler user-service _config)

Handler for profile edit submission (POST /web/profile).

HTMX handler that updates profile and returns updated card.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for profile edit submission (POST /web/profile).

HTMX handler that updates profile and returns updated card.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

profile-info-fragment-handlerclj

(profile-info-fragment-handler user-service _config)

Handler to return profile info card fragment (GET /web/profile/info).

Handler to return profile info card fragment (GET /web/profile/info).
sourceraw docstring

profile-page-handlerclj

(profile-page-handler user-service mfa-service config)

Handler for the profile page (GET /web/profile).

Displays user profile with all sections: info, preferences, security, MFA.

Args: user-service: User service instance mfa-service: MFA service instance config: Application configuration map

Returns: Ring handler function

Handler for the profile page (GET /web/profile).

Displays user profile with all sections: info, preferences, security, MFA.

Args:
  user-service: User service instance
  mfa-service: MFA service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

register-page-handlerclj

(register-page-handler config)

GET /web/register - render self-service registration page.

GET /web/register - render self-service registration page.
sourceraw docstring

register-submit-handlerclj

(register-submit-handler user-service config)

POST /web/register - validate data, create user account.

POST /web/register - validate data, create user account.
sourceraw docstring

reset-mfa-handlerclj

(reset-mfa-handler user-service _config)

POST /web/users/:id/mfa/reset: turns off the user's second factor (admin).

POST /web/users/:id/mfa/reset: turns off the user's second factor (admin).
sourceraw docstring

revoke-all-sessions-handlerclj

(revoke-all-sessions-handler user-service _config)

Handler for revoking all user sessions (POST /web/users/:id/sessions/revoke-all).

Invalidates all sessions for a user, optionally keeping the current session active.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for revoking all user sessions (POST /web/users/:id/sessions/revoke-all).

Invalidates all sessions for a user, optionally keeping the current session active.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

revoke-session-handlerclj

(revoke-session-handler user-service _config)

Handler for POST /web/users/:id/sessions/:session-id/revoke: ends one of the user's sessions, forcing that device to sign in again. Sessions are named by id; the page never sees a token (BOU-696).

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for POST /web/users/:id/sessions/:session-id/revoke: ends one of the
user's sessions, forcing that device to sign in again. Sessions are named by
id; the page never sees a token (BOU-696).

Args:
  user-service: User service instance
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

unlock-user-handlerclj

(unlock-user-handler user-service _config)

POST /web/users/:id/unlock: ends the user's sign-in lockout (admin).

POST /web/users/:id/unlock: ends the user's sign-in lockout (admin).
sourceraw docstring

user-detail-redirectclj

(user-detail-redirect request)

GET /web/users/:id, the user's page before the admin's edit page replaced it: a redirect there, so old links keep working. Not an id: the list.

GET /web/users/:id, the user's page before the admin's edit page replaced
it: a redirect there, so old links keep working. Not an id: the list.
sourceraw docstring

user-sessions-page-handlerclj

(user-sessions-page-handler user-service _config)

Handler for user sessions management page (GET /web/users/:id/sessions).

Displays all active sessions for a user with ability to revoke individual sessions or all sessions except current.

Args: user-service: User service instance config: Application configuration map

Returns: Ring handler function

Handler for user sessions management page (GET /web/users/:id/sessions).

Displays all active sessions for a user with ability to revoke individual
sessions or all sessions except current.

Args:
  user-service: User service instance
  config: Application configuration map
  
Returns:
  Ring handler function
sourceraw docstring

users-page-handlerclj

(users-page-handler user-service _config)

Handler for the users listing page (GET /web/users), with shared search filters (q, role, status). The table's controls request this URL and push it, so the address bar holds sort, filters and page; they get the table fragment back.

Handler for the users listing page (GET /web/users), with shared search
filters (q, role, status). The table's controls request this URL and push
it, so the address bar holds sort, filters and page; they get the table
fragment back.
sourceraw docstring

users-table-fragment-handlerclj

(users-table-fragment-handler user-service _config)

Handler for the users table fragment (GET /web/users/table), for callers that ask for the table alone. The table's own controls request /web/users.

Handler for the users table fragment (GET /web/users/table), for callers
that ask for the table alone. The table's own controls request /web/users.
sourceraw docstring

web-root-page-handlerclj

(web-root-page-handler user-service config)

Handler for the web root landing page (GET /web).

Shows logo, welcome message and login link for unauthenticated users. Authenticated users (valid session cookie present) are redirected to their landing page. With :landing set, everyone is redirected there.

Args: user-service: User service instance for session validation config: Application configuration map

Returns: Ring handler function

Handler for the web root landing page (GET /web).

Shows logo, welcome message and login link for unauthenticated users.
Authenticated users (valid session cookie present) are redirected to their
landing page. With `:landing` set, everyone is redirected there.

Args:
  user-service: User service instance for session validation
  config: Application configuration map

Returns:
  Ring handler function
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close