forked from GithubBackups/healthchecks
Add Credential.created field
This commit is contained in:
parent
53688f1d87
commit
03ea725612
@ -1,4 +1,4 @@
|
||||
# Generated by Django 3.1.2 on 2020-11-12 13:39
|
||||
# Generated by Django 3.1.2 on 2020-11-12 15:29
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
@ -20,8 +20,9 @@ class Migration(migrations.Migration):
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('code', models.UUIDField(default=uuid.uuid4, unique=True)),
|
||||
('name', models.CharField(blank=True, max_length=200)),
|
||||
('created', models.DateTimeField(auto_now_add=True)),
|
||||
('data', models.BinaryField()),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='credentials', to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
@ -397,6 +397,7 @@ class Credential(models.Model):
|
||||
code = models.UUIDField(default=uuid.uuid4, unique=True)
|
||||
name = models.CharField(max_length=200, blank=True)
|
||||
user = models.ForeignKey(User, models.CASCADE, related_name="credentials")
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
data = models.BinaryField()
|
||||
|
||||
def unpack(self):
|
||||
|
@ -62,3 +62,6 @@ span.loading {
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
#my-keys th {
|
||||
border-top: 0;
|
||||
}
|
||||
|
@ -63,26 +63,34 @@
|
||||
<div class="panel-body settings-block">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<h2>Two Factor Authentication</h2>
|
||||
<h2>Two-factor Authentication</h2>
|
||||
{% if profile.user.credentials.exists %}
|
||||
<table class="table">
|
||||
<table id="my-keys" class="table">
|
||||
<tr>
|
||||
<th>Security keys</th>
|
||||
</tr>
|
||||
{% for credential in profile.user.credentials.all %}
|
||||
<tr>
|
||||
<td>{{ credential.code }}</td>
|
||||
<td>{{ credential.name|default:"unnamed" }}</td>
|
||||
<td>
|
||||
<strong>{{ credential.name|default:"unnamed" }}</strong>
|
||||
– registered on {{ credential.created|date:"M j, Y" }}
|
||||
</td>
|
||||
<td class="text-right"><a href="#">Remove</a></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% else %}
|
||||
<p>
|
||||
Your account has no registered two factor authentication
|
||||
methods.
|
||||
Your account has no registered security keys.
|
||||
Two-factor authentication is disabled.
|
||||
</p>
|
||||
{% endif %}
|
||||
<a
|
||||
href="{% url 'hc-add-credential' %}"
|
||||
class="btn btn-default pull-right">Add 2FA Credential</a>
|
||||
class="btn btn-default pull-right">
|
||||
Register New Security Key
|
||||
</a>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user