Skip to content

Commit 6264166

Browse files
authored
docs(dev): add more context around accounts and totp (#16255)
1 parent 94059bc commit 6264166

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed

docs/dev/development/email.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ Calling a function with the ``_email`` decorator does the following:
4343
- A metric is sent to Datadog named `warehouse.emails.scheduled` with the tags
4444
``template_name``, ``allow_unverified``, and ``repeat_window``.
4545

46+
.. _testing-e-mails:
47+
4648
Testing e-mails
4749
---------------
4850

docs/dev/development/getting-started.rst

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,66 @@ http://localhost:80/account/login/.
323323
To log in as an admin user, log in as ``ewdurbin`` with the password
324324
``password``. Due to session invalidation, you may have to login twice.
325325

326+
Some user accounts that you might want to try are:
327+
328+
- `ewdurbin` - Superuser, 3 email addresses (one verified), has projects
329+
- `di` - Superuser, 2 email addresses (both verified), has projects
330+
- `dstufft` - Superuser, 2 email addresses (one verified), has projects
331+
- `miketheman` - Regular user, 1 email address (not verified), has a project
332+
333+
There are no Moderator accounts in the dev db, any Superuser can change a user
334+
to a moderator if needed.
335+
336+
Using different accounts will allow you to see different parts of the site,
337+
and have slightly different experiences.
338+
339+
For example, using `miketheman` will require email verification.
340+
See :ref:`testing-e-mails` for more information on how to see those emails.
341+
342+
Once logged in, you must enroll in a form of Two-Factor Authentication (2FA).
343+
This is a requirement for all users.
344+
345+
One way to make this easier is to use a command-line tool like
346+
`totp-cli <https://yitsushi.github.io/totp-cli/>`_ to generate a TOTP 2FA code.
347+
348+
For example, to generate a code for any of the above users,
349+
we have a common Key set in the database for those users:
350+
351+
.. code-block:: console
352+
353+
$ totp-cli instant <<< IU7UP3EMIPI7EBPQUUSEHEJUFNBIWOYG
354+
355+
This will emit a 6-digit code you can paste into the 2FA form.
356+
357+
For other accounts, you'll need to preserve the Key used
358+
to genreate the TOTP code the next time you need to log in.
359+
360+
To be able to "forget" the initial Key, and use it like a TOTP app,
361+
create a storage and set a password, like so:
362+
363+
.. code-block:: console
364+
365+
$ totp-cli add-token localhost <username>
366+
Token: <paste Key from warehouse web interface here>
367+
Password: <set a password, is unique to this totp storage>
368+
369+
Then you can retrieve the current TOTP code with:
370+
371+
.. code-block:: console
372+
373+
$ totp-cli g localhost <username>
374+
Password: <the password you set for the totp storage>
375+
376+
Keep in mind: If the database is ever reset,
377+
you'll need to re-enroll user accounts in 2FA.
378+
379+
Remove the existing TOTP token from storage with:
380+
381+
.. code-block:: console
382+
383+
$ totp-cli delete localhost <username>
384+
Password: <the password you set for the totp storage>
385+
326386
327387
Stopping Warehouse and other services
328388
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)