Skip to content

Improve login layout with proper labels#1266

Open
nooreldeensalah wants to merge 3 commits intocanonical:mainfrom
nooreldeensalah:improve-cli-login-layout
Open

Improve login layout with proper labels#1266
nooreldeensalah wants to merge 3 commits intocanonical:mainfrom
nooreldeensalah:improve-cli-login-layout

Conversation

@nooreldeensalah
Copy link
Contributor

@nooreldeensalah nooreldeensalah commented Feb 13, 2026

Closes #1263

I've tested these changes on LXD container, for the QR code testing, I've used lxc console command. I'm unsure if this is the ideal way or not.

Note: I've ran the tests locally with the TESTS_UPDATE_GOLDEN flag, and it edited multiple test files, which I commited to a separate branch nooreldeensalah@35b1378. Should I cherry-pick this commit to this PR?

SSH (Before)

== Device Authentication ==
Open the URL and enter the code below.
https://www.google.com/device
        CHD-DSN-RNTH

  1. Wait for authentication result
  2. Request new code

SSH (After)

== Device Authentication ==
Open the URL and enter the code below.

URL: https://www.google.com/device
Code: ZRF-FDP-XRFV

  1. Wait for authentication result
  2. Request new code

QR (Before)

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
                      https://www.google.com/device
                               GGM-WRP-FNNF

                            [ Request new code ]

QR (After)

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
                      https://www.google.com/device
                            Code: GJZ-VYM-QKBJ

                            [ Request new code ]

@edibotopic
Copy link
Contributor

Thanks @nooreldeensalah

QR (After)

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
                      https://www.google.com/device
                            Code: GJZ-VYM-QKBJ

                            [ Request new code ]

For consistency with the SSH interface, shouldn't a label also be prepended to the URL here, like so:

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
                      URL: https://www.google.com/device
                            Code: GJZ-VYM-QKBJ

                            [ Request new code ]

@nooreldeensalah nooreldeensalah force-pushed the improve-cli-login-layout branch from dfce212 to e1d3bb7 Compare February 13, 2026 11:45
@nooreldeensalah
Copy link
Contributor Author

I've updated it as suggested @edibotopic, I initially followed the suggestion from this comment regarding the label becoming long on the issue.

Let me know if any more changes are needed!

This is how it looks like now (from lxc console output)

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
                    URL: https://www.google.com/device
                            Code: TGM-DRC-BRMX

                            [ Request new code ]

@edibotopic
Copy link
Contributor

edibotopic commented Feb 13, 2026

I've updated it as suggested @edibotopic, I initially followed the suggestion from this #1263 (comment) regarding the label becoming long on the issue.

Thanks. I think it's more visually consistent. The URL is first mentioned many lines before the QR, so it's no harm to be maximally explicit about what we are referring to, so that the connection is clear and the user can scan the text efficiently.

But also, I'm not sure there is any practical advantage to centering the text for the URL and Code below the QR; if anything, it makes the text less readable. And the original comment was about the string being too long when centering is applied.

So, I think this would be fine:

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████

URL:  https://www.google.com/device
Code: TGM-DRC-BRMX

                            [ Request new code ]

I think that it makes more sense to have [Request new code] set apart by centering.

I'm not testing this, but I would also suggest (as shown in my example above) adding a newline between the QR and the strings below (if it doesn't exist already) for clearer visual separation.

Any issue with the reasoning above @adombeck ?

@nooreldeensalah
Copy link
Contributor Author

Current layout after the latest commit

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████

URL: https://www.google.com/device
Code: JZF-DRK-LNKH

                            [ Request new code ]

@adombeck
Copy link
Contributor

Any issue with the reasoning above @adombeck ?

Not at all. It makes sense to me, even though I was initially a bit hesitant to replace the center alignment with left alignment, because I found it visually appealing. However, I agree that, when combined with the labels, the left alignment makes it more readable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter complains about an ineffectual assignment to firstQrCodeLine in this line. It's correct, the variable is not used anymore, you now directly use m.uiLayout.GetContent() as the URL - which makes sense to me, because we pass the content as the URL and also use it to generate the QR code. I wonder why we tried to use the first line of the rendered QR code instead. Do you remember, @3v1n0?

Comment on lines +740 to 741
qrcodeView = append(qrcodeView, fmt.Sprintf("Code: %s", code))
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add another space between the URL: label and the URL, to make it align with the code, as @edibotopic suggested in #1266 (comment):

Suggested change
qrcodeView = append(qrcodeView, fmt.Sprintf("Code: %s", code))
}
qrcodeView = append(qrcodeView, fmt.Sprintf("URL: %s", m.uiLayout.GetContent()))
qrcodeView = append(qrcodeView, fmt.Sprintf("Code: %s", code))
} else {
qrcodeView = append(qrcodeView, fmt.Sprintf("URL: %s", m.uiLayout.GetContent()))
}

@adombeck
Copy link
Contributor

I've tested these changes on LXD container, for the QR code testing, I've used lxc console command. I'm unsure if this is the ideal way or not.

That seems reasonable since this change should only affect the command-line interface. When testing changes which involve gnome-shell / GDM, you will probably want to set up a VM and share the authd repository between your host and the VM. I can help you with that.

@adombeck
Copy link
Contributor

Note: I've ran the tests locally with the TESTS_UPDATE_GOLDEN flag, and it edited multiple test files, which I commited to a separate branch nooreldeensalah@35b1378. Should I cherry-pick this commit to this PR?

Yes, please! That will hopefully fix the tests which are currently failing (beside the flaky ones - if you see the "Retry Go Tests with Coverage Collection" job fail, that's a quite reliable indication that there's actually something wrong).

@nooreldeensalah nooreldeensalah force-pushed the improve-cli-login-layout branch from 3b57eed to 18104bd Compare February 13, 2026 17:21
@nooreldeensalah nooreldeensalah force-pushed the improve-cli-login-layout branch from 18104bd to e802ab7 Compare February 13, 2026 17:22
@nooreldeensalah
Copy link
Contributor Author

I've tested these changes on LXD container, for the QR code testing, I've used lxc console command. I'm unsure if this is the ideal way or not.

That seems reasonable since this change should only affect the command-line interface. When testing changes which involve gnome-shell / GDM, you will probably want to set up a VM and share the authd repository between your host and the VM. I can help you with that.

Thanks, I appreciate that! it would definitely be helpful :)

I've re-generated the golden tests, and pushed them in my latest commit. And I've addressed your latest suggestions as well.

Current layout after adding the whitespace:

SSH

== Device Authentication ==
Open the URL and enter the code below.

URL:  https://www.google.com/device
Code: MLT-TGC-ZDNF

  1. Wait for authentication result
  2. Request new code

QR

██████████████████████████████████████████████████████████████████████████
██████████████████████████████████████████████████████████████████████████

URL:  https://www.google.com/device
Code: RMX-HWJ-SNHY

                            [ Request new code ]

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.02%. Comparing base (1b9ea6b) to head (e802ab7).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1266      +/-   ##
==========================================
+ Coverage   85.00%   86.02%   +1.01%     
==========================================
  Files         119       99      -20     
  Lines        7669     6674     -995     
  Branches      111      111              
==========================================
- Hits         6519     5741     -778     
+ Misses       1094      877     -217     
  Partials       56       56              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

Improve layout of CLI login prompt without QR code

3 participants

Comments