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

[totp] feat: set and verify tools #2127

Merged
merged 18 commits into from
Jan 25, 2021

Conversation

victorgcramos
Copy link
Member

@victorgcramos victorgcramos commented Sep 4, 2020

This PR Closes #2120

This diff adds the SET and VERIFY TOTP (Time-based One-Time Password) features. Now users will be able to set the Two-Factor Authentication (2FA) on their accounts , which will be required to perform the login action once it's enabled.

How to set the 2FA?

This tutorial was made using the FreeOTP app, an open source two-factor authentication application for systems utilizing one-time password protocols.

  1. 👤 On your Account page, go to the Two-Factor Authentication tab.
    Before setting the 2FA on your account, please remember to save the backup key. This will be required in case you lost your authenticator.

    The backup key should be treated the same way you treat a password and should not be stored digitally.

  2. 🤳 Scan the QR Code with your authentication app. In this case, we'll be using FreeOTP.

  3. 📲 Verify the 6-digits code generated by the authenticator.

Example:

totp-set-cms-test

The 2FA can also be enabled on CMS

😄 🔐 Done! You have enabled the 2FA on your account

How to disable the 2FA

After setting the TOTP, you can disable it on Account > Two-Factor Authentication.

Just fill in the blanks with the 6-digits code generated by your authenticator

Example:

totp-reset-cms-test-2

How to recover the authentication code.

Once you have the backup key saved, you can recover it by generating a new QR Code from it. In this case, I'll be using the FreeOTP QR Code Generator:

  1. Change the algorithm to SHA1 instead of SHA256

  2. Set it to Timeout

  3. On Account field, type your username

  4. On Secret (Base 32) insert the saved backup key

    You should see something like this:
    totp-free-otp-example-2

  5. Scan the generated QR Code. Now you have recovered it and you can use it to login to your account.

@victorgcramos victorgcramos changed the title [wip] totp: set and verify tools totp: set and verify tools Sep 8, 2020
@victorgcramos victorgcramos marked this pull request as ready for review September 8, 2020 18:56
Copy link
Member

@alexlyp alexlyp left a comment

Choose a reason for hiding this comment

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

tACK works well and looks pretty good.

@victorgcramos victorgcramos changed the title totp: set and verify tools [totp] feat: set and verify tools Dec 2, 2020
@alexlyp
Copy link
Member

alexlyp commented Dec 10, 2020

works great on login!

only suggestion i have is to have a definite cursor or highlight on mousing over an already populated digit.

Currently once a digit is populated the blue line doesn't change to it's hard to know if you have that digit selected.

Maybe change it to a slightly darker blue tone when already populated and hovered?

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

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

Good job, left a few comments.

src/components/DigitsInput/DigitsInput.jsx Outdated Show resolved Hide resolved
src/components/DigitsInput/DigitsInput.module.css Outdated Show resolved Hide resolved
src/containers/User/Totp/Set.jsx Outdated Show resolved Hide resolved
src/containers/User/Totp/Totp.jsx Outdated Show resolved Hide resolved
src/containers/User/Totp/Verify.jsx Show resolved Hide resolved
src/components/DigitsInput/DigitsInput.jsx Outdated Show resolved Hide resolved
Copy link
Member

@thi4go thi4go left a comment

Choose a reason for hiding this comment

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

Hey mate functionality working great, nice job. Got just few comment.

As of now, I have to fail a login first to enable totp code insertion, and then do a successful login. Not sure the best way to go here, but I thought of two things; we can store this info on the user's browser (not a fan of this), or we could add a checkbox on the login form that shows/hides the totp input part.

src/containers/User/hooks/useTotp.js Show resolved Hide resolved
src/components/DigitsInput/DigitsInput.jsx Outdated Show resolved Hide resolved
Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

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

Code is looking pretty good.

Some points:

  1. These should be submitted when hitting enter.

Screen Shot 2021-01-20 at 12 45 29

Screen Shot 2021-01-20 at 12 46 44

  1. The switch should be focused after hitting tab on password (tabindex)

Screen Shot 2021-01-20 at 12 48 16

  1. This loading indicator should be centered

2facauth

  1. Question: Can you edit the recommended logo in the TOTP authenticator app?

image

@victorgcramos
Copy link
Member Author

@tiagoalvesdulce updated the code to include the requested changes. About item 4, I don't think we can change that. From what I could see, this is up to the TOTP App, not the code itself.

After taking a look at https://github.com/pquerna/otp (the one we use on backend), I couldn't figure a way out to handle this default image.

Copy link
Member

@tiagoalvesdulce tiagoalvesdulce left a comment

Choose a reason for hiding this comment

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

Looking great!

@tiagoalvesdulce tiagoalvesdulce merged commit fa41d7c into decred:master Jan 25, 2021
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.

totp: Add Set/Verify TOTP in account area
4 participants