@webx-ui/module-auth
@webx-ui/module-auth
Signing in to a WebX UI admin panel: the screen, the session and the router guard.
The front-end half of the Composer package
webx-ui/module-auth, which is what
closes the panel on the server. This is what lets somebody back in.
Install
pnpm add @webx-ui/module-auth @webx-ui/module-admin @webx-ui/core vue vue-router
import { createAdmin } from '@webx-ui/module-admin'
import { auth, WxUserMenu } from '@webx-ui/module-auth'
createAdmin({
plugins: [auth()],
userMenu: WxUserMenu,
}).mount()
That is the whole integration. Installing it also tells the panel how to find out who is signed
in, which is why @webx-ui/module-admin knows nothing about authentication — it holds the answer, not
the question.
A plugin, not a section
It owns a route and a guard and has no place in the menu:
/loginrenders the card- a guard sends anybody without a session there, remembering where they were going
- a watcher brings them back when the session arrives, and out again when it ends — a sign-out in another tab, an account switched off
Redirects are driven by the panel's state rather than by an event from the card. Signing in
flips the panel to ready, the shell swaps the branch it renders, and the card is unmounted
before the line after await runs.
The card
No logo, no product name, no welcome. An admin panel's front door should say as little as possible to somebody who has no business behind it, and the people who do already know where they are.
What it does carry: a password reveal, a Caps Lock warning, autocomplete="username" and
current-password so password managers work, validation errors landing on the right field, and
a countdown when the server throttles.
Every string is a prop, and a prop given wins. What happens when one is not given is that the
label comes from the panel's dictionary — assembled by the server from the same lang files it
writes its own messages from, so the card and the 422 under its fields speak one language
without anybody listing labels twice.
// Nothing to pass: a panel in Ukrainian draws a Ukrainian card.
auth()
// Unless this particular panel wants its own words.
auth({ card: { submitLabel: 'Увійти' } })
Placed outside a panel, with no server to ask, the card falls back to the English it ships.
WxLoginCard is exported for a panel that wants to place it itself.
The sections
Two of them, alongside the plugin:
import { admins, connect } from '@webx-ui/module-auth'
createAdmin({ modules: [admins(), connect()] })
admins() is the people, and two more views of the same section for whoever may see them:
Agent calls (admins.audit) — every tool call an agent made, narrowed by person, tool and
outcome — and Connections (admins.manage), the agents everybody has let in, with a
button that ends one.
connect() is the page that tells somebody how to connect their own agent: the address, a
button that copies it, three steps per client, one-click links for Cursor and VS Code, and
their own connections underneath. It carries no permission — whoever got into the panel may
connect an agent, and the agent cannot do anything they cannot. Both appear only where the
server reports them, so a panel with no agent server has no such entry.
The session
import { useAuth } from '@webx-ui/module-auth'
const auth = useAuth()
await auth.login({ email, password, remember: true })
await auth.logout()
const user = await auth.me() // null when nobody is
await auth.setLocale('uk') // the language this administrator reads the panel in
There is nothing kept here: the session lives in a cookie, the server is the source of truth, and the panel asks rather than remembers.
Licence
MIT.
Related Packages
The frame a WebX UI admin panel runs in: bootstrap, the shell, the HTTP client a...
The file manager of a WebX UI admin panel: folders, files, uploads and an image...
Site settings for the WebX UI admin panel: the section that draws the settings s...
Screens as JSON for WebX UI admin panels: the node format, patches, the type reg...
The block constructor for the WebX UI admin panel: the section where a block typ...
Version History
| Version | Released | License |
|---|---|---|
| 0.14.1 | MIT | |
| 0.14.0 | MIT | |
| 0.13.0 | MIT | |
| 0.12.0 | MIT | |
| 0.11.1 | MIT | |
| 0.11.0 | MIT | |
| 0.10.2 | MIT | |
| 0.10.1 | MIT | |
| 0.10.0 | MIT | |
| 0.9.4 | MIT | |
| 0.9.3 | MIT | |
| 0.9.2 | MIT | |
| 0.9.1 | MIT | |
| 0.9.0 | MIT | |
| 0.8.15 | MIT | |
| 0.8.14 | MIT | |
| 0.8.13 | MIT | |
| 0.8.12 | MIT | |
| 0.8.11 | MIT | |
| 0.8.10 | MIT | |
| 0.8.9 | MIT | |
| 0.8.8 | MIT | |
| 0.8.7 | MIT | |
| 0.8.6 | MIT | |
| 0.8.5 | MIT | |
| 0.8.4 | MIT | |
| 0.8.3 | MIT | |
| 0.8.2 | MIT | |
| 0.8.1 | MIT | |
| 0.8.0 | MIT |
Showing the latest 30 of 50. See every release on npm