Skip to content

Commit

Permalink
Circling the drain trying to get passkey login to work.
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Sargent committed Feb 3, 2024
1 parent a42ad09 commit b25ad35
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions approval_polls/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,13 @@
"django.contrib.auth.backends.ModelBackend",
"passkeys.backend.PasskeyModelBackend",
] # Change your authentication backend

FIDO_SERVER_ID = "vote.electionscience.org" # Server rp id for FIDO2, it the full domain of your project
FIDO_SERVER_NAME = "vote.electionscience.org"
if DEBUG:
FIDO_SERVER_ID = (
"localhost" # Server rp id for FIDO2, it the full domain of your project
)
FIDO_SERVER_NAME = "localhost"

KEY_ATTACHMENT = None
10 changes: 4 additions & 6 deletions approval_polls/templates/registration/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
<div class="container mt-5">
<div class="row justify-content-center">
<div class="col-md-6">
{% if form.errors %}
<div class="alert alert-danger" role="alert">Invalid credentials. Please try again.</div>
{% endif %}
{% if invalid %}<div class="alert alert-danger">Invalid Username or password</div>{% endif %}
<div class="card">
<div class="card-header text-center">Login</div>
<div class="card-body">
<form method="post"
action="{% if next %}/accounts/login/?next={{ next }}{% else %}/accounts/login/{% endif %}"
action="{% if next %}/accounts/login/?next= {{ next }}{% else %}/accounts/login/{% endif %}"
id="loginForm">
{% csrf_token %}
{% if invalid %}<div class="alert alert-danger" role="alert">Invalid Username or Password</div>{% endif %}
Expand All @@ -36,23 +34,23 @@
placeholder="Password">
</div>
<button type="submit" class="btn btn-primary w-100">Login</button>
<input type="hidden" name="passkeys" id="passkeys" />
<div class="text-center mt-3">
<input type="hidden" name="passkeys" id="passkeys" />
<button class="btn btn-block btn-dark"
type="button"
onclick="authn('loginForm')">
<img src="{% static 'passkeys/imgs/FIDO-Passkey_Icon-White.png' %}"
style="width: 24px">
&nbsp;Login with Passkey
</button>
{% include 'passkeys.js' %}
</div>
<div class="text-center mt-3">
<a href="{% url 'registration_register' %}">Need an account? Register</a>
</div>
<div class="text-center mt-3">
<a href='{% url 'auth_password_reset' %}'>Forgot Password?</a>
</div>
{% include 'passkeys.js' %}
</form>
</div>
</div>
Expand Down

0 comments on commit b25ad35

Please sign in to comment.