Two-factor authentication for the backend
The biggest new feature in 2.1 is two-factor authentication (2FA) for the backend. Once it’s on, every backend user confirms their login with a second factor. That can be a code sent by e-mail or a code from an authenticator app (TOTP) such as Aegis, 2FAS, Google Authenticator or Microsoft Authenticator.
- Fully self-hosted. The QR code for the authenticator app is generated on your server. No external service is involved.
- Recovery codes. Setup ends with 10 one-time recovery codes, in case you lose access to your second factor.
- Trust this device for 30 days. After the second factor you can mark a device as trusted. The password is still required. You can see and remove trusted devices in your personal settings, and changing your password or setting up 2FA again removes all of them.
- Self-service. Every backend user manages their own 2FA under User menu → Settings. They can set it up, switch methods, create new recovery codes, or turn it off as long as it isn’t required.
- Administrator overview. Administrators with the user right can see who has 2FA set up and can reset it for other users.
- Emergency switch.
$se_2fa_bypassskips 2FA for a single user until a date you choose. The dashboard shows a warning while it’s set.
In 2.1, 2FA is off by default. To require it for all backend users, add this line to data/config.php:
$se_2fa_required = true;
The dashboard will also suggest turning on 2FA. You can hide that hint.
Safer logins and password handling
We reworked several parts of authentication:
- Password reset without e-mailed passwords. The link in the reset e-mail now opens a form where you choose a new password yourself. SwiftyEdit no longer sends passwords by e-mail. Reset links are valid for one hour and work only once.
- Changing your password needs your current password. This applies in the frontend profile.
- Temporary lockouts. After too many failed login attempts, an account is now locked for a short time instead of until someone uses the unlock link. The lock starts at one minute and doubles up to 60 minutes. Repeated failed attempts from the same client are slowed down as well.
- Admin rights only through the backend login. Administrator rights are now granted only when you log in at
/admin/. A frontend login gives administrators a regular user session, with moderation rights kept. To see draft previews, private pages and the frontend edit helpers, log in through/admin/. - Session lifetime enforced on the server. The backend session lifetime from your settings is now checked on the server too, not only by the countdown in the browser. Because of this, the old “remember me” checkbox is gone. With 2FA, “trust this device” takes its place.
Comment moderation now follows your settings
The comment mode setting now works as intended. If you chose “All comments must be approved by an admin”, new comments wait for approval in your inbox. If you chose “Deactivate the comment function”, no new comments are accepted.
A better update page
- Update notices. The update page now shows notices from swiftyedit.net, for example announcements about changes in upcoming versions. They arrive with the version information the page loads anyway, so there’s no extra request.
- Clearer channel overview (since 2.0.1). Stable, beta and alpha are shown together, each with its build and date. Your installed version is marked, and the “not for production” warning appears next to beta and alpha.
- Simpler flow. Download results and the installation log appear right below the button that started them. Several issues that made you reload the page between steps are fixed.
A lighter default theme
The default theme no longer includes jQuery or js-cookie. Its core script loads only htmx. This makes the frontend smaller and fits the HTMX-based approach used across SwiftyEdit.
The old cookie notice, which depended on jQuery, was removed with it.
Smarty output cache removed
In 2.0.1 we removed the Smarty output cache and its settings. It barely made pages faster, and it could show the same content to every visitor, including the wrong pagination, filters, sorting or voting state. Compiled templates are not affected. On existing installations you can delete the data/cache/cache/ folder.
More hardening and fixes
- Backend writers for plugins (
/admin-xhr/<module>/write/) only accept POST requests with a valid CSRF token. - With
$se_upload_addons = false, updating addons from the backend is disabled too, not just installing them. - Uploaded raster images are limited to 50 megapixels.
- The output of
[plugin=...]and[script]is no longer parsed for[image=],[file=]and[mod=]shortcodes. - The outdated
[include]shortcode was removed. - Fixed: plugins whose names contain a module name (such as “snapshop”) were sent to the wrong backend reader.
- Fixed: the
/avatars/alias was missing from the.htaccesstemplate, so new installations could be missing profile avatars. - Fixed: personal backend settings could only be opened by users with the right to manage users.
- Fixed: the backend login page ignored the timezone from your settings.
- The backend help is more robust, and documentation links and heading anchors work properly.
- Dependencies and translations are updated.
Before you update: notes for theme developers
If your custom theme has its own copies of the templates below, update them. Otherwise these features will stop working:
password.tpl: the new password reset form. With an old copy, users can’t reset their passwords anymore.profile/change-password.tpl: the new field for the current password. With an old copy, changing the password in the profile always fails.registerform.tpl: the live password-repeat check now uses hx-post and includes the CSRF token.
Themes without their own copies automatically use the updated templates from the default theme. The simplest check is to compare your copies with the default theme.
A few more things to know:
- If your templates are based on the default theme and use jQuery, they now have to load jQuery themselves.
- If you customized the
mail_psw_updatedsnippet and it contains{temp_psw}, update the text. That placeholder is now always empty. - The update adds the new database columns automatically. SwiftyEdit also creates data/site_secret.php, which you should keep private.
- Anyone who voted anonymously before the update can vote once more, because anonymous votes are now identified differently.
Looking ahead
In a future version, 2FA will be on by default, and you’ll be able to turn it off in data/config.php. We’ll announce this ahead of time through the new update notices. If you want to get used to it now, you can turn it on today with the single line above.
The complete list of changes is in the changelog. Thanks to everyone who tested, reported issues and translated. Happy updating!