[PR #6034] [PM-26810] Add OTP support to VerifyPasswordScreen #6255

Closed
opened 2025-11-27 00:21:29 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/bitwarden/android/pull/6034

State: closed
Merged: Yes


🎟️ Tracking

PM-26810

📔 Objective

This commit introduces support for One-Time Passcode (OTP) verification on the "Verify Password" screen, in addition to the existing master password verification. This is primarily for TDE users who do not have a master password set on their account.

The behavioral changes are as follows:

  • If a user does not have a master password, they will be prompted to enter a 6-digit OTP code that is automatically sent to their email address.
  • The UI displays a "Resend code" button for the OTP flow.
  • The primary action button label has been changed from "Unlock" to "Continue" to accommodate both verification flows.

Specific changes include:

  • ViewModel:
    • VerifyPasswordViewModel now checks if the active account has a master password.
    • If no master password exists, it automatically requests an OTP and updates the UI to reflect the OTP verification flow.
    • New actions (ResendCodeClick, SendOtpCodeResultReceive, VerifyOtpResultReceive) and events (ShowSnackbar) have been added to handle the OTP logic.
    • The UnlockClick action has been renamed to ContinueClick.
    • The state has been updated to include a title, subtext, and showResendCodeButton to dynamically adjust the screen content.
  • UI (Screen & Composables):
    • VerifyPasswordScreen.kt and its content composable have been updated to conditionally display either the master password field or the OTP code field based on the view model's state.
    • A "Resend code" button is now shown for the OTP flow.
    • The main button is now labeled "Continue" and triggers the ContinueClick action.
    • A snackbar is now used to show feedback, for instance when an OTP code has been resent.
  • Strings:
    • New string resources have been added for the OTP verification flow, such as "Verify your account email address".
  • Tests:
    • VerifyPasswordViewModelTest and VerifyPasswordScreenTest have been extensively updated to cover the new OTP verification logic, state changes, and UI interactions. Existing tests were refactored to align with the new logic.

📸 Screenshots

Master Password verification

Before After

OTP Verification

Before After
N/A

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
**Original Pull Request:** https://github.com/bitwarden/android/pull/6034 **State:** closed **Merged:** Yes --- ## 🎟️ Tracking PM-26810 ## 📔 Objective This commit introduces support for One-Time Passcode (OTP) verification on the "Verify Password" screen, in addition to the existing master password verification. This is primarily for TDE users who do not have a master password set on their account. The behavioral changes are as follows: * If a user does not have a master password, they will be prompted to enter a 6-digit OTP code that is automatically sent to their email address. * The UI displays a "Resend code" button for the OTP flow. * The primary action button label has been changed from "Unlock" to "Continue" to accommodate both verification flows. Specific changes include: * **ViewModel:** * `VerifyPasswordViewModel` now checks if the active account has a master password. * If no master password exists, it automatically requests an OTP and updates the UI to reflect the OTP verification flow. * New actions (`ResendCodeClick`, `SendOtpCodeResultReceive`, `VerifyOtpResultReceive`) and events (`ShowSnackbar`) have been added to handle the OTP logic. * The `UnlockClick` action has been renamed to `ContinueClick`. * The state has been updated to include a `title`, `subtext`, and `showResendCodeButton` to dynamically adjust the screen content. * **UI (Screen & Composables):** * `VerifyPasswordScreen.kt` and its content composable have been updated to conditionally display either the master password field or the OTP code field based on the view model's state. * A "Resend code" button is now shown for the OTP flow. * The main button is now labeled "Continue" and triggers the `ContinueClick` action. * A snackbar is now used to show feedback, for instance when an OTP code has been resent. * **Strings:** * New string resources have been added for the OTP verification flow, such as "Verify your account email address". * **Tests:** * `VerifyPasswordViewModelTest` and `VerifyPasswordScreenTest` have been extensively updated to cover the new OTP verification logic, state changes, and UI interactions. Existing tests were refactored to align with the new logic. ## 📸 Screenshots ### Master Password verification | Before | After | |--------|--------| | <img width="365" src="https://github.com/user-attachments/assets/c1e6a108-a78f-4938-8093-735ce074b7e6" /> | <img width="365" src="https://github.com/user-attachments/assets/afe29845-47e2-4764-9a2f-d1901155e57e" /> | ### OTP Verification | Before | After | |--------|--------| | N/A | <img width="365" src="https://github.com/user-attachments/assets/216d5782-04e2-46cf-a2a2-6d1e07dc86ce" /> | ## ⏰ 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 <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+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
GiteaMirror added the pull-request label 2025-11-27 00:21:29 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#6255