diff --git a/crates/pdfs-cli/src/main.rs b/crates/pdfs-cli/src/main.rs index b0e4bd3..927dc05 100644 --- a/crates/pdfs-cli/src/main.rs +++ b/crates/pdfs-cli/src/main.rs @@ -2273,22 +2273,7 @@ fn cmd_login(username: Option, remember: bool) -> Result<()> { get_mailbox, get_hv, )) - .map_err(|e| { - // Proton words this block as "update the app", which the user can't - // act on: the release is current and only waiting helps. - let blocked = - matches!(&e, pdfs_core::Error::Proton(p) if pdfs_core::error::sign_in_blocked(p)); - let e = anyhow::Error::new(e).context("login failed"); - if blocked { - e.context( - "Proton is temporarily refusing sign-in from this device (code 2028). \ - Your version is not the problem. Wait several hours, up to a day, \ - without trying again, then sign in.", - ) - } else { - e - } - })?; + .map_err(login_failure)?; // A daemon that is already up is parked in `wait_for_session`, sleeping // between keyring checks; restart it so the mount appears now instead of @@ -2304,6 +2289,18 @@ fn cmd_login(username: Option, remember: bool) -> Result<()> { Ok(()) } +fn login_failure(error: pdfs_core::Error) -> anyhow::Error { + if matches!(&error, pdfs_core::Error::Proton(e) if pdfs_core::error::sign_in_blocked(e)) { + // The SDK logs the response code at debug level. Its server text + // would give contradictory instructions in the displayed cause chain. + anyhow::anyhow!( + "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." + ) + } else { + anyhow::Error::new(error).context("login failed") + } +} + /// Ask for the mailbox password of a two-password account, without echo. fn prompt_mailbox(attempt: u32, remember: bool) -> pdfs_core::Result { if attempt == 0 { @@ -4884,6 +4881,25 @@ mod diagnose_tests { mod login_wait_tests { use super::*; + #[test] + fn login_failure_preserves_only_actionable_upgrade_advice() { + use pdfs_core::proton_sdk::{ProtonApiError, ProtonError, api::ResponseCode}; + for (code, blocked) in [ + (ResponseCode::Blocked, true), + (ResponseCode::OutdatedApp, false), + ] { + let error = ProtonError::Api(ProtonApiError { + code, + http_status: 422, + message: "Please update the app".into(), + details: None, + }); + let rendered = format!("{:#}", login_failure(error.into())); + assert_eq!(rendered.contains("2028"), blocked); + assert_eq!(rendered.contains("Please update"), !blocked); + } + } + /// The mount retry backs off from 5 s to a ceiling of minutes, rather than /// asking Proton every 5 s forever (`docs/BUGS.md` B263). #[test] diff --git a/crates/pdfs-gui/src/app/pages/login.rs b/crates/pdfs-gui/src/app/pages/login.rs index 84f2269..387a3e5 100644 --- a/crates/pdfs-gui/src/app/pages/login.rs +++ b/crates/pdfs-gui/src/app/pages/login.rs @@ -316,7 +316,7 @@ pub(crate) fn login_error_message(error: &pdfs_core::Error) -> String { // Proton's text for this one asks the user to update an app that is // already current. pdfs_core::Error::Proton(e) if pdfs_core::error::sign_in_blocked(e) => gettext( - "Proton is temporarily refusing sign-in from this device. Your app version is not the problem. Wait several hours, up to a day, without trying again, then sign in.", + "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support.", ), pdfs_core::Error::Proton(ProtonError::Api(api)) if !api.message.is_empty() => { api.message.clone() @@ -770,10 +770,31 @@ mod tests { details: None, })); let message = login_error_message(&error); - assert!(message.contains("temporarily refusing"), "{message}"); + assert!(message.contains("code 2028"), "{message}"); assert!(!message.contains("update"), "{message}"); } + #[test] + fn outdated_clients_and_rate_limits_keep_their_own_guidance() { + use pdfs_core::proton_sdk::{ProtonApiError, ProtonError, api::ResponseCode}; + for (code, status, expected) in [ + (ResponseCode::OutdatedApp, 422, "Please update the app"), + ( + ResponseCode::TooManyRequests, + 429, + "Too many sign-in attempts", + ), + ] { + let error = ProtonError::Api(ProtonApiError { + code, + http_status: status, + message: "Please update the app".into(), + details: None, + }); + assert!(login_error_message(&error.into()).contains(expected)); + } + } + #[test] fn an_unmapped_error_keeps_its_text() { let error = pdfs_core::Error::Other("something odd".into()); diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index a1c894d..677260d 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -11,6 +11,8 @@ scratch (user data in `staging/` and `recovery/` is never touched by this). ## [Unreleased] +- Sign-in failures with Proton code 2028 now give consistent recovery guidance in the desktop app and CLI (#39). + ## [3.10.0] — 2026-11-22 Schema: **47**. The trash table gets an index on the original folder, and its stored rows are diff --git a/docs/TROUBLESHOOTING.md b/docs/TROUBLESHOOTING.md index 4de01f3..b15ff03 100644 --- a/docs/TROUBLESHOOTING.md +++ b/docs/TROUBLESHOOTING.md @@ -100,14 +100,14 @@ The page then runs without WebKit's isolation, so use this only for the sign-in. session keeps working without it. Signing in from your usual network, without a VPN, often avoids the CAPTCHA in the first place. -### "This version of the app is no longer supported" or "Proton is temporarily refusing sign-in from this device" +### "This version of the app is no longer supported" or sign-in code 2028 -Proton blocks sign-in for a while after too many attempts, or from a network it distrusts. It sends -the first message even when your version is current. Do not retry for several hours, up to a day, -then sign in once. +For code 2028, pause before trying again. Proton does not give the client an expiry time. +If the block persists, check whether you can sign in at [Drive on the web](https://drive.proton.me) +and mention the code, client version and web sign-in result when contacting Proton support. -If it still fails, run `RUST_LOG=debug pdfs login` and look for `code=` in the -`proton api request failed` line. 2028 is this block; 5003 is a release Proton no longer accepts. +If an older client only says to update, look for the `proton api request failed` line in +`RUST_LOG=debug pdfs login`. Code 5003 means Proton no longer accepts that app version. ### Sign-in works but is forgotten after a restart diff --git a/images/issue-39.png b/images/issue-39.png new file mode 100644 index 0000000..eb31c93 Binary files /dev/null and b/images/issue-39.png differ diff --git a/po/de.po b/po/de.po index f8826f7..d5a6501 100644 --- a/po/de.po +++ b/po/de.po @@ -3710,14 +3710,8 @@ msgid "Too many sign-in attempts. Wait a few minutes and try again." msgstr "Zu viele Anmeldeversuche. Einige Minuten warten und erneut versuchen." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton lehnt Anmeldungen von diesem Gerät vorübergehend ab. Die App-Version " -"ist nicht das Problem. Einige Stunden, bis zu einem Tag, warten, ohne es " -"erneut zu versuchen, dann anmelden." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton hat diese Anmeldung abgelehnt (Code 2028). Warte vor einem weiteren Versuch. Bleibt das Problem bestehen, versuche die Anmeldung im Browser und nenne dem Proton-Support den Code 2028." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/en_GB.po b/po/en_GB.po index 02be235..fa8d14a 100644 --- a/po/en_GB.po +++ b/po/en_GB.po @@ -3652,14 +3652,8 @@ msgid "Too many sign-in attempts. Wait a few minutes and try again." msgstr "Too many sign-in attempts. Wait a few minutes and try again." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/es.po b/po/es.po index 1fbdb05..ab5fc01 100644 --- a/po/es.po +++ b/po/es.po @@ -3685,14 +3685,8 @@ msgstr "" "nuevo." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton rechaza temporalmente el inicio de sesión desde este dispositivo. La " -"versión de la aplicación no es el problema. Espere varias horas, hasta un " -"día, sin volver a intentarlo y luego inicie sesión." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton ha rechazado este inicio de sesión (código 2028). Espera antes de volver a intentarlo. Si el problema persiste, prueba a iniciar sesión en la web y menciona el código 2028 al contactar con el soporte de Proton." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/fr.po b/po/fr.po index 7112644..710b32b 100644 --- a/po/fr.po +++ b/po/fr.po @@ -3710,14 +3710,8 @@ msgstr "" "Trop de tentatives de connexion. Patientez quelques minutes et réessayez." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton refuse temporairement la connexion depuis cet appareil. La version de " -"l’application n’est pas en cause. Patientez plusieurs heures, jusqu’à un " -"jour, sans réessayer, puis connectez-vous." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton a refusé cette connexion (code 2028). Patientez avant de réessayer. Si le problème persiste, essayez de vous connecter sur le Web et indiquez le code 2028 à l’assistance Proton." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/it.po b/po/it.po index bf4d890..55a8abf 100644 --- a/po/it.po +++ b/po/it.po @@ -3698,14 +3698,8 @@ msgid "Too many sign-in attempts. Wait a few minutes and try again." msgstr "Troppi tentativi di accesso. Attendi qualche minuto e riprova." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton sta rifiutando temporaneamente l'accesso da questo dispositivo. La " -"versione dell'app non è il problema. Attendi alcune ore, fino a un giorno, " -"senza riprovare, poi accedi." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton ha rifiutato questo accesso (codice 2028). Attendi prima di riprovare. Se il problema persiste, prova ad accedere dal web e indica il codice 2028 quando contatti l’assistenza Proton." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/nl.po b/po/nl.po index df6c5e0..9280214 100644 --- a/po/nl.po +++ b/po/nl.po @@ -3694,14 +3694,8 @@ msgstr "" "Te veel aanmeldpogingen. Wacht een paar minuten en probeer het opnieuw." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton weigert tijdelijk aanmeldingen vanaf dit apparaat. Je app-versie is " -"niet het probleem. Wacht enkele uren, tot een dag, zonder het opnieuw te " -"proberen en meld je daarna aan." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton heeft deze aanmelding geweigerd (code 2028). Wacht voordat je het opnieuw probeert. Blijft het probleem bestaan, probeer dan via de website in te loggen en vermeld code 2028 wanneer je contact opneemt met Proton-ondersteuning." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/pdfs.pot b/po/pdfs.pot index e988d16..9332b96 100644 --- a/po/pdfs.pot +++ b/po/pdfs.pot @@ -3528,10 +3528,7 @@ msgid "Too many sign-in attempts. Wait a few minutes and try again." msgstr "" #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." msgstr "" #: crates/pdfs-gui/src/app/pages/login.rs:325 diff --git a/po/pl.po b/po/pl.po index c05c2a0..4664f38 100644 --- a/po/pl.po +++ b/po/pl.po @@ -3762,14 +3762,8 @@ msgstr "" "Za dużo prób logowania. Proszę odczekać kilka minut i spróbować ponownie." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"Proton tymczasowo odrzuca logowanie z tego urządzenia. Wersja aplikacji nie " -"jest problemem. Proszę odczekać kilka godzin, maksymalnie dobę, bez " -"ponownych prób, a następnie się zalogować." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "Proton odrzucił tę próbę logowania (kod 2028). Poczekaj przed kolejną próbą. Jeśli problem nie ustąpi, spróbuj zalogować się przez przeglądarkę i podaj kod 2028 podczas kontaktu z pomocą techniczną Proton." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again." diff --git a/po/pt_BR.po b/po/pt_BR.po index ef0b0f8..2ad604f 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -3684,14 +3684,8 @@ msgid "Too many sign-in attempts. Wait a few minutes and try again." msgstr "Muitas tentativas de entrar. Aguarde alguns minutos e tente novamente." #: crates/pdfs-gui/src/app/pages/login.rs:319 -msgid "" -"Proton is temporarily refusing sign-in from this device. Your app version is " -"not the problem. Wait several hours, up to a day, without trying again, then " -"sign in." -msgstr "" -"O Proton está recusando temporariamente a entrada a partir deste " -"dispositivo. A versão do app não é o problema. Aguarde algumas horas, até um " -"dia, sem tentar novamente e depois entre." +msgid "Proton declined this sign-in (code 2028). Wait before trying again. If it persists, try signing in on the web and mention code 2028 when contacting Proton support." +msgstr "O Proton recusou este login (código 2028). Aguarde antes de tentar novamente. Se o problema persistir, tente entrar pela web e informe o código 2028 ao contatar o suporte do Proton." #: crates/pdfs-gui/src/app/pages/login.rs:325 msgid "Couldn't reach Proton. Check your internet connection and try again."