Allow to use either OTP or FIDO for 2FA

This commit is contained in:
devStorm 2020-05-05 05:16:33 -07:00
parent 650d6e35f0
commit 9da6054ec0
No known key found for this signature in database
GPG Key ID: D52E1B66F336AC57
4 changed files with 15 additions and 2 deletions

View File

@ -26,6 +26,12 @@
<button id="btnVerifyKey" class="btn btn-success mt-2">Use your security key</button>
</div>
{% if enable_otp %}
<div class="text-center text-muted mb-6" style="margin-top: 1em;">
Don't have your key with you? <br> <a href="{{ url_for('auth.mfa') }}">Verify by One-Time Password</a>
</div>
{% endif %}
<script>
async function verifyKey () {
$("#btnVerifyKey").prop('disabled', true);

View File

@ -28,6 +28,12 @@
<button class="btn btn-success mt-2">Validate</button>
</form>
{% if enable_fido %}
<div class="text-center text-muted mb-6" style="margin-top: 1em;">
Having trouble with your authenticator? <br> <a href="{{ url_for('auth.fido') }}">Verify by your security key</a>
</div>
{% endif %}
</div>
{% endblock %}

View File

@ -102,4 +102,5 @@ def fido():
webauthn_assertion_options = webauthn_assertion_options.assertion_dict
return render_template("auth/fido.html", fido_token_form=fido_token_form,
webauthn_assertion_options=webauthn_assertion_options)
webauthn_assertion_options=webauthn_assertion_options,
enable_otp=user.enable_otp)

View File

@ -55,4 +55,4 @@ def mfa():
else:
flash("Incorrect token", "warning")
return render_template("auth/mfa.html", otp_token_form=otp_token_form)
return render_template("auth/mfa.html", otp_token_form=otp_token_form, enable_fido=(user.fido_uuid is not None))