Skip to content

fix(auth-passkey): remove wordWrap to keep FIDO prompt single-line - #78

Draft
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/developer/425c3309
Draft

fix(auth-passkey): remove wordWrap to keep FIDO prompt single-line#78
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:agent/developer/425c3309

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

问题

登录界面(greeter)切换到 FIDO 安全密钥认证后,提示文案跨两行显示;锁屏界面同一提示文案正常单行展示。

根因

AuthPasskey::initUI()src/session-widgets/auth_passkey.cpp)中 m_textLabel->setWordWrap(true) 配合文本 label stretch=0(嵌在带双侧 stretch 的子布局中),使 QHBoxLayout 可将 label 压缩至低于整句宽度,触发换行。

greeter 与锁屏共用同一 AuthPasskey 组件,但运行环境的缩放/字体不同:greeter(约 1.5x 缩放)渲染使文本宽度超过换行阈值,锁屏(1.0x)未超过。其它认证模块(AuthFingerprint/AuthFace/AuthIris)因不设 wordWrap 或给 label stretch=1,不受影响。

改动

删除 AuthPasskey::initUI()m_textLabel->setWordWrap(true); 一行,与 AuthFingerprint 保持一致。

     /* 文案提示 */
     m_textLabel->setText(tr("Please plug in the security key"));
-    m_textLabel->setWordWrap(true);

     /* 旋转提示和文案提示布局 */

移除 wordWrap 后,QLabel 的 minimumSizeHint() == sizeHint()(完整单行宽度),QHBoxLayout 无法再压缩该 label,两侧 stretch 自动让出空间,文案结构性保证单行展示——对 greeter 与锁屏均生效,锁屏无回归(由"碰巧不换行"变为"结构上不可换行")。

验证

  • 代码审核:通过(98 分)
  • 编译打包:Qt6 编译通过,deb 包已构建(dde-session-shell 6.0.66)
  • 未改动 greeter 字体设置(bug 161915 相关)及其它认证模块

说明

  • GitHub master 分支为 v20/Qt5 变体,系统实际运行的 6.0.x 为 Qt6/snipe 变体,两者 auth_passkey.cpp 经验证完全一致(唯一差异即本次删除行),故直接在 master 分支提交。
  • 本 PR 为 draft,待人工审核合并。

Summary by Sourcery

Keep passkey authentication prompts on a single line across authentication environments.

Bug Fixes:

  • Prevent FIDO security-key authentication prompts from wrapping onto multiple lines in the greeter and lock screen.

Chores:

  • Update the auth-passkey source copyright year range.

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Aug 18, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Removes word wrapping on the FIDO/passkey prompt label so the layout structurally enforces a single-line message across greeter and lock screen, aligning behavior with other biometric auth widgets.

File-Level Changes

Change Details Files
Disable word wrapping on the FIDO security key prompt label to prevent layout-induced line breaks.
  • Removed the call that enabled word wrapping on the passkey prompt QLabel in the AuthPasskey UI initialization.
  • Relied on QLabel’s single-line size hint so the HBox layout and surrounding stretches keep the prompt on a single line across different scaling/font environments.
  • Kept behavior consistent with AuthFingerprint and other auth modules that do not enable wordWrap on their prompt labels.
src/session-widgets/auth_passkey.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@MyLeeJiEun
MyLeeJiEun force-pushed the agent/developer/425c3309 branch from 1e8f5f3 to 477e37f Compare August 18, 2026 08:11
1. Remove setWordWrap(true) from AuthPasskey::initUI
2. Align with AuthFingerprint which does not enable wordWrap
3. wordWrap plus stretch=0 let the layout shrink the label below
   full text width, wrapping the FIDO prompt to two lines in greeter
4. Without wordWrap the label keeps full single-line width in both
   greeter and lock
5. Update SPDX-FileCopyrightText year 2023 to 2026 in the file

Log: Fixed FIDO security key prompt wrapping to two lines on the login screen; it now stays on a single line.

Influence:
1. Log out or reboot to the login screen, switch to FIDO security key auth and confirm the prompt shows on a single line
2. On the lock screen switch to FIDO auth and confirm the prompt is still single-line (no regression)
3. Verify other auth modules (password, fingerprint, face, iris) are unaffected
4. Check the prompt under different display scales and resolutions

fix: 保持 FIDO 提示单行并更新 SPDX 版权年份

1. 删除 AuthPasskey::initUI 中的 setWordWrap(true)
2. 与不开启 wordWrap 的 AuthFingerprint 保持一致
3. wordWrap 配合 stretch=0 使布局可将 label 压缩到低于整句宽度,
   导致登录界面 FIDO 提示文案跨两行
4. 移除 wordWrap 后 label 保持完整单行宽度,登录与锁屏均单行展示
5. 更新文件头 SPDX-FileCopyrightText 版权年份 2023 为 2026

Influence:
1. 注销或重启到登录界面,切换到 FIDO 安全密钥认证,确认提示单行展示
2. 锁屏界面切换到 FIDO 认证,确认提示仍单行(无回归)
3. 验证其它认证模块(密码/指纹/面容/虹膜)不受影响
4. 在不同缩放与分辨率下检查提示文案显示

Log: 修复登录界面 FIDO 安全密钥提示文案跨两行显示的问题,现单行展示。
PMS: BUG-370733
@MyLeeJiEun
MyLeeJiEun force-pushed the agent/developer/425c3309 branch from 477e37f to c985bb0 Compare August 18, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants