Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-11502] Support Remember Email option when using SSO authentication #13391

Open
wants to merge 51 commits into
base: main
Choose a base branch
from

Conversation

trmartin4
Copy link
Member

@trmartin4 trmartin4 commented Feb 13, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-11502

📔 Objective

The Remember Email option was not working correctly when using SSO authentication.

Previously, the Remember Email choice only took effect after authentication was complete. This necessitated a lot of extra code and complexity in the LoginEmailService in order to track the user's email, as well as whether they want to remember it (but don't remember it yet!) through the various authentication flows. The reason SSO didn't work is because that particular flow didn't handle it correctly after login.

Rather than build on that complexity, this PR changes the underlying assumption of when the Remember Email choice takes affect. The Remember Email option now takes effect as soon as you perform some action on the Login screen. This adjustment has been verified as acceptable by Product. The choice to remember email now takes effect when:

  • Login v1
    • Click Continue
    • Click Login with Passkey (web only)
  • New Login
    • Click Continue
    • Click Login with Passkey (web only)
    • Click Login with SSO

This allowed the simplification of the LoginEmailService interface quite a bit. The LoginEmailService now has two pieces of state it manages:

  • loginEmail
    • The email address the user entered, which is always stored in memory state regardless of whether the user chose to remember their email. This is used programmatically, in code, to maintain context of the user's email address through the login process.
    • It is set with setLoginEmail and exposed via the loginEmail$ observable.
  • rememberedEmail
    • The email address that the user has chosen to remember. If the user has chosen not to remember their email, this will be null.
    • It is set with the setRememberEmailChoice method and exposed via the rememberedEmail$ observable.

📸 Screenshots

Web

Demonstrating that the remembered email persists through all operations, including SSO

New UI

web_remember_email_persists.mov

Old UI

remember_email_v1_web.mov

Desktop

Demonstrating that adding an account does not remember email, but logging in does

New UI

desktop_add_account_not_remembered.mov

Old UI

remember_email_v1_desktop.mov
remember_mail_v1_desktop_new_account.mov

Extension

Demonstrating that adding an account does not remember email, but logging in does

New UI

extension_not_remembered_account_add.mov

Old UI

remember_email_v1_extension.mov
remember_email_v1_extension_add_account.mov

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

Attention: Patch coverage is 8.04598% with 80 lines in your changes missing coverage. Please review.

Project coverage is 35.61%. Comparing base (b4bfacf) to head (958262d).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
libs/auth/src/angular/login/login.component.ts 0.00% 53 Missing ⚠️
.../angular/src/auth/components/login-v1.component.ts 0.00% 10 Missing ⚠️
apps/browser/src/auth/popup/home.component.ts 0.00% 5 Missing ⚠️
apps/web/src/app/auth/login/login-v1.component.ts 0.00% 5 Missing ⚠️
...-verification/new-device-verification.component.ts 0.00% 3 Missing ⚠️
...s-handler/default-login-success-handler.service.ts 0.00% 2 Missing ⚠️
apps/web/src/app/auth/two-factor.component.ts 0.00% 1 Missing ⚠️
...nents/two-factor-auth/two-factor-auth.component.ts 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #13391   +/-   ##
=======================================
  Coverage   35.60%   35.61%           
=======================================
  Files        3141     3141           
  Lines       93078    93050   -28     
  Branches    16925    16916    -9     
=======================================
- Hits        33144    33143    -1     
+ Misses      57397    57371   -26     
+ Partials     2537     2536    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

github-actions bot commented Feb 13, 2025

Logo
Checkmarx One – Scan Summary & Detailse5574e02-386b-4e5f-b10b-b5d66f4fe585

Great job, no security vulnerabilities found in this Pull Request

@trmartin4 trmartin4 marked this pull request as ready for review February 13, 2025 21:36
@trmartin4 trmartin4 requested a review from a team as a code owner February 13, 2025 21:36
@trmartin4 trmartin4 marked this pull request as draft February 14, 2025 16:39
@trmartin4 trmartin4 force-pushed the auth/pm-11502/remember-email-sso branch from 83e66fe to ed11203 Compare February 18, 2025 23:32
Base automatically changed from auth/pm-17751/remember-sso-email to main February 21, 2025 22:09
@trmartin4 trmartin4 marked this pull request as ready for review February 22, 2025 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants