-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 2FA configurable & optional for user accounts (#23)
* Make 2FA configurable & optional for user accounts * Separate 2FA from default login flow * Update url pattern for 2FA verification * Remove OTP from registration view * Update list display in users app admin * Add tests for TwoFactorVerificationForm * Update tests for CustomAuthenticationForm * Update tests for CustomUserChangeForm * Update test_forms.py * Update tests for CustomUser model * Update tests for account view * Fix typos in form tests
- Loading branch information
1 parent
71e0e14
commit 90e34ef
Showing
13 changed files
with
280 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.17 on 2025-01-01 15:54 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0004_customuser_session_timeout'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='customuser', | ||
name='enable_2fa', | ||
field=models.BooleanField(default=False), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Generated by Django 4.2.17 on 2025-01-01 16:14 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('users', '0005_customuser_enable_2fa'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='customuser', | ||
name='enable_2fa', | ||
field=models.BooleanField(default=False, verbose_name='Enable 2FA'), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
{% extends "passmanager/base.html" %} | ||
{% load crispy_forms_tags %} | ||
|
||
{% block title %}2FA Verification{% endblock title %} | ||
|
||
{% block page_header %} | ||
<h2>Log in to your account.</h2> | ||
{% endblock page_header %} | ||
|
||
{% block content %} | ||
{% if messages %} | ||
{% for message in messages %} | ||
<div class="alert alert-success">{{ message }}</div> | ||
{% endfor %} | ||
{% endif %} | ||
|
||
<form action="{% url 'users:2fa_verification' %}" method="post" class="form"> | ||
{% csrf_token %} | ||
{{ form|crispy }} | ||
<button name="submit" class="btn btn-dark w-100">Verify</button> | ||
<input type="hidden" name="next" value="{% url 'passmanager:vault' %}" /> | ||
</form> | ||
{% endblock content %} | ||
|
||
{% block footer %} | ||
<!-- footer start --> | ||
<footer class="footer bg-light text-dark py-2 fixed-bottom"> | ||
<div class="container"> | ||
<hr class="border-dark mb-1" width="100%"> | ||
<div class="row justify-content-between align-items-center"> | ||
<div class="col-12 col-md-6 mt-3 text-center text-md-start"> | ||
<p>© <script>document.write(new Date().getFullYear());</script> KafetzisThomas</p> | ||
</div> | ||
<div class="col-12 col-md-6 text-center text-md-end mt-md-0"> | ||
<a href="https://www.paypal.me/kafetzisthomas" target="_blank" class="btn btn-link btn-floating btn-md text-dark m-1 border" role="button" style="text-decoration: none;"> | ||
<i class="bi bi-heart-fill"></i> Donate | ||
</a> | ||
<a href="mailto: passmanagerweb@gmail.com" target="_blank" class="btn btn-link btn-floating btn-md text-dark m-1 border" role="button"> | ||
<i class="bi bi-envelope-fill"></i> | ||
</a> | ||
<a href="https://x.com/PassManagerWeb" target="_blank" class="btn btn-link btn-floating btn-md text-dark m-1 border" role="button"> | ||
<i class="bi bi-twitter-x"></i> | ||
</a> | ||
<a href="https://github.com/KafetzisThomas/PassManagerWeb" target="_blank" class="btn btn-link btn-floating btn-md text-dark m-1 border" role="button"> | ||
<i class="bi bi-github"></i> | ||
</a> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> | ||
<!-- footer end --> | ||
{% endblock footer %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.