Repository navigation
Add login with two-factor authentication - #9
Merged
Merged
Conversation
The plugin exchanges the password, and for users with 2FA a TOTP or backup code entered in a second step, for a webmail credential from the Userli API. Roundcube uses the credential for IMAP and SMTP, the session ends when it expires, and logging out revokes it. With a Userli version without the login endpoint, the plugin keeps logging in with the password. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Skip requests that Roundcube rejects anyway (no CSRF token or session) instead of sending the password to Userli - Drop an expired pending login before showing the code form, and do not call Userli for a code without a valid pending login - Remove the pending login with rcube_session::remove(), so it does not stay in the stored session - Revoke the credential in session_destroy, after Roundcube's own logout actions, and when the IMAP login fails after Userli issued one - Show messages for too many attempts and a required password change - Log the fallback to password login when Userli has no login endpoint - Validate the credential and expiry types in the Userli response - Drop the inputmode attribute, which Roundcube filters out - Require Roundcube 1.5 (get_input_string, get_http_client) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d login The code step gets a "Use another account" link that drops the pending login. It is answered with HTTP 200 instead of 401, because the password was right: brute-force detection on the proxy access log (CrowdSec) must not count it. Wrong codes stay 401. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 25, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
t2d
marked this pull request as ready for review
October 25, 2026 20:00
t2d
requested review from
0x46616c6b,
doobry-systemli and
y3n4
as code owners
October 25, 2026 20:00
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requires systemli/userli PR 1394.
Goal
Two-factor authentication for webmail. Userli can require app passwords in mail programs for users with 2FA, so Roundcube needs its own 2FA step.
Changes
authenticatesends the password toPOST /api/roundcube/login. For users with 2FA, the login form turns into a code step (TOTP or backup code). The password is kept encrypted in the session for up to 5 minutes and is never shown in the form.session_destroy, after Roundcube's own logout actions) and when the IMAP login fails after Userli issued it.userlilog and keeps logging in with the password. The plugin can therefore be deployed before Userli.Screenshots
Tested end to end against the Userli dev stack: password login, 2FA with TOTP and backup code, wrong and expired code, logout, alias sync, the session ending when the credential expires, the rate limit, and a request without CSRF token. The setting was tested both on and off.
🤖 Generated with Claude Code