Skip to content

Change recovery codes filename to reflect testpypi or pypi #9190

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

Closed
diegoe opened this issue Mar 10, 2021 · 7 comments
Closed

Change recovery codes filename to reflect testpypi or pypi #9190

diegoe opened this issue Mar 10, 2021 · 7 comments
Labels
good first issue This issue is ideal for first-time contributors!

Comments

@diegoe
Copy link

diegoe commented Mar 10, 2021

What's the problem this feature will solve?
Currently if you generate recovery codes for testpypi and pypi, both files are suggested for download as PyPI-Recovery-Codes.txt.

Describe the solution you'd like
The suggested filename reflects the origin. Example: TestPyPi-Recovery-Codes.txt and PyPi-Recovery-Codes.txt.

Additional context
It should be possible to change it to an if/else to set a prefix at:
https://github.com/pypa/warehouse/blob/main/warehouse/templates/manage/account/recovery_codes-provision.html#L64-L66

@ewdurbin
Copy link
Member

@diegoe this is an excellent suggestion. If you'd like to open a Pull Request with this change the necessary logic for determining when to prefix is visible in https://github.com/pypa/warehouse/blob/60afeb136c55574b0deb6c36a2a416c951203633/warehouse/templates/base.html#L74-L76

@ewdurbin
Copy link
Member

I'm not positive, but the testPyPI variable may even be accessible since the template for the recovery codes extends from manage_base which extends from base.

@di di added the good first issue This issue is ideal for first-time contributors! label Mar 11, 2021
@di
Copy link
Member

di commented Mar 11, 2021

I'm not positive, but the testPyPI variable may even be accessible since the template for the recovery codes extends from manage_base which extends from base.

Yes, this should be true!

I've added the "good first issue" label to this issue.

@abidahmadq
Copy link

@di I can try this issue if you can give me more context.

@AustinTSchaffer
Copy link
Contributor

AustinTSchaffer commented May 1, 2021

@Abid1998 I'm not di, but commenting for additional context:

If you set up an account, verify your email address, and set up 2-factor authentication, the "Account Settings" menu gives you an additional option for generating/regenerating account recovery codes. These codes can be used to get access to your account in the event your 2-factor authentication device becomes inaccessible, gets lost, breaks, etc. Once you generate some codes, you have the option to download them as a text file.

image

(I generated these codes running warehouse on localhost, but figured I should partially black them out anyway.)

This would be changing the default name for that text file to "TestPyPI-Recovery-Codes.txt" when you're on test.pypi.org, as opposed to "PyPI-Recovery-Codes.txt" when you're on pypi.org, probably to reduce confusion and prevent users from overwriting their actual recovery codes when using test.pypi.org.

Hope this helps!

@deniszh
Copy link
Contributor

deniszh commented May 16, 2021

Hello!
I created PR #9535 for fixing this. Let me know if I doing something terribly wrong.
/cc @ewdurbin @di

Thanks a lot!

di added a commit that referenced this issue May 18, 2021
* Fixing recovery code filename for test site (fixing #9190)

* Fixing translations

* Simplifying logic for consistency with other templates

Co-authored-by: Dustin Ingram <[email protected]>
@ewjoachim
Copy link
Contributor

I think it's all good now, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue This issue is ideal for first-time contributors!
Projects
None yet
Development

No branches or pull requests

7 participants