Download the PHP package volkmann-design-code/kirby-dev-login without Composer
On this page you can find all versions of the php package volkmann-design-code/kirby-dev-login. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download volkmann-design-code/kirby-dev-login
More information about volkmann-design-code/kirby-dev-login
Files in volkmann-design-code/kirby-dev-login
Package kirby-dev-login
Short Description One-click login buttons on the Panel login, for local development
License MIT
Homepage https://github.com/volkmann-design-code/kirby-dev-login
Informations about the package kirby-dev-login
Kirby Dev Login
Kirby 5 · PHP 8.2–8.5 · MIT
One-click login for local development: the Panel's login form gets a button per account, which logs that account in without a password. Handy when you switch between roles all day.
Kirby's login form stays as it is; the buttons sit below it. The plugin
uses Kirby's own extension point for the login form
(panel.plugin(…, { login })), no DOM patching.
Safe by default
The buttons, and the two API routes behind them, only exist when
debugistrue, and- the site runs on a local host (Kirby's
$kirby->environment()->isLocal():localhost,*.local,*.test,*.ddev.site, or every visitor IP is127.0.0.1/::1).
Otherwise the routes answer 404 and the login form looks as always. Only accounts with Panel access get a button. A login still needs the Panel's CSRF token, like Kirby's own login route.
Similar concepts and plugins
- Kirby Impersonate by nerdcel: admins (or allowed roles) view the Panel as another user from a button on that user's profile page, also on a live site. You log in first, and the impersonation runs within your own session until you end it. It checks what a user sees; Dev Login skips the login while you develop. The two work side by side.
- Kirby Autologin
by Jens Törnell, for Kirby 2 and no longer maintained: on localhost,
visiting
/loginor/login/<username>logged you into the Panel without a password. Dev Login brings the idea to Kirby 5, with a button per account instead of a URL to know. - The Kirby team's test environment for Kirby itself
(not a plugin) logs its test accounts in through a URL
(
/env/auth/<email>) and has a dialog in the Panel to switch to another account once you are logged in.
Install
Composer
As a dev dependency it stays out of deployments built with
composer install --no-dev.
Git submodule
Download
Download the latest release
and unzip it into site/plugins/dev-login.
Without Composer, make sure the plugin doesn't reach your live site,
e.g. by leaving site/plugins/dev-login out of the deployment. It stays
off there anyway unless debug is on and the host is local.
Kirby lets one plugin replace the login form, so this plugin can't be combined with another that does.
Usage
Turn on debug in your local config and open the Panel's login page:
Below the login form, click an account to log in as it.
Options
Buttons are sorted by role, then name; each shows the name and, in parentheses, the role (just the name when both are the same); the email on hover.
With description, each account is a card instead (Kirby's cardlet
layout) that also shows its role's description from the user
blueprint, for example to explain the roles of a public demo.
With collapse, the accounts come first and Kirby's login form opens
from a button below them ("Log in with email"), for sites where most
people log in with a click and a few still need the form.
How it works
GET /api/dev-login: the accounts (email,name,role, and with thedescriptionoption the role'sdescription), andcollapsePOST /api/dev-loginwithemail:$user->loginPasswordless()index.js: the login form plugin. It renders Kirby'sk-login-formand the buttons below. Written with render functions, so it works without the Panel's template compiler (panel.vue.compiler: false).
Languages
The label above the buttons comes in English and German, and falls back
to English in other Panel languages; role titles are translated by
Kirby. More languages are welcome as a pull request (index.php).
Development
The cover images .github/cover.png (2:1) and .github/cover-square.png
(1:1) are rendered from a real Panel with made-up accounts, the same on
every run (pinned Chromium and fonts):
License
MIT, see volkmann design code.