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.
This implementation is influenced by: https://tag1consulting.com/blog/building-api-django-20-part-i
Created some endpoints to:
Main part that is still not working is that we don't want to authenticate the
user if it has a otp configured but not filled in.
To try the current solution:
Login with admin/admin
Enable the OTP by navigating to http://localhost:8000/otp/create/
Copy the response that starts with "otpauth://"
Create a QR code with help of google (there are other ways) by appending the above response to:
https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=
So it looks something like this:
https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl=otpauth://totp/admin?secret=H27UTUREIAIWDXF6FVV6X4NGNC7VFATO&algorithm=SHA1&digits=6&period=30
Open Google Authenticator (or some other similar tool) in your phone and scan the above generated image. You should get timed autogenerated numbers in your phone.
To verify, go to: http://localhost:8000/otp/verify/ and fill in the number you have in your phone a the json token like this:
{ "token": 123456 }
If the token is correct you should get Status code 201
To delete the otp, go to: http://localhost:8000/otp/delete/ and POST the request.