feat(breaking/login): remove 2fa
flag in favor of better prompts
#619
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧰 Changes
The
--2fa
flag that's required to log in withrdme
is clunky. Now that we've overhauled our prompts system, it was stupidly easy to add a flow that goes something like this:User logs in with username and password
API returns a 401 with the
LOGIN_TWOFACTOR
code, meaning the user forgot to include a 2FA coderdme
checks the error response for theLOGIN_TWOFACTOR
code. In that case, it prompts the user for the token and sends another login request with the token!1By removing the
2fa
flag in therdme
client, the login flow is infinitely more smooth. The other great thing is that this requires no changes to our API, so we can maintain backwards compatibility with older versions ofrdme
.This PR also includes some minor testbed housekeeping as well.
🧬 QA & Testing
Do these changes make sense to you? And do tests pass?
Footnotes
If the API returns any other error, it just throws it as it normally would. ↩