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

[Improve] Two-step verification code is automatically filled out #15403

Closed
Hill-98 opened this issue Apr 11, 2021 · 3 comments
Closed

[Improve] Two-step verification code is automatically filled out #15403

Hill-98 opened this issue Apr 11, 2021 · 3 comments
Labels
good first issue Likely to be an easy fix type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@Hill-98
Copy link

Hill-98 commented Apr 11, 2021

  • Gitea version (or commit ref): v1.14.0

Description

1Password does not currently support two-step verification code that automatically fills in Gitea, I suggest that you can improve this experience.

Maybe you can modify the id and name of the input to twofactor_tokeen (I found that CloudFlare is so)

@techknowlogick techknowlogick added good first issue Likely to be an easy fix type/proposal The new feature has not been accepted yet but needs to be discussed first. labels Apr 11, 2021
@Jonher937
Copy link
Contributor

Do you have any documentation showing what 1Password (and possibly other Password managers) are looking for?

I made a small modification on the input of the 2FA page to make the experience a bit better on mobile (showing only numeric keyboard and on Android it suggest pasting the OTP code).

diff --git a/templates/user/auth/twofa.tmpl b/templates/user/auth/twofa.tmpl
index 68b474c86..a9ed66c43 100644
--- a/templates/user/auth/twofa.tmpl
+++ b/templates/user/auth/twofa.tmpl
@@ -11,7 +11,7 @@
                                        {{template "base/alert" .}}
                                        <div class="required inline field">
                                                <label for="passcode">{{.i18n.Tr "passcode"}}</label>
-                                               <input id="passcode" name="passcode" type="number" autocomplete="off" autofocus required>
+                                               <input id="passcode" name="passcode" type="text" autocomplete="one-time-code" inputmode="numeric" pattern="[0-9]*" autofocus required>
                                        </div>
 
                                        <div class="inline field">

Can you try if that makes it better for 1Password too?
Although I believe 1Password does not have support for pasting directly to OTP fields, but does offer an automatic copy of the OTP code on autofill so you have the OTP code in copy-paste

@Hill-98
Copy link
Author

Hill-98 commented Jul 17, 2021

I tested this patch, although 1Password does not automatically populate it, but will display a list of fills. When I click on the list item, the 2fa code will appear in the input box.

This is a nice improvement.

@zeripath
Copy link
Contributor

@Jonher937 would you like to send a PR with that?

@6543 6543 closed this as completed Jul 18, 2021
@go-gitea go-gitea locked and limited conversation to collaborators Oct 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Likely to be an easy fix type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

No branches or pull requests

5 participants