Skip to content

Commit 5284534

Browse files
committed
Iterate over the first step
1 parent bfb5de6 commit 5284534

File tree

9 files changed

+10
-10
lines changed

9 files changed

+10
-10
lines changed

config/django/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555

5656
INSTALLED_APPS = [
5757
# "django.contrib.admin",
58-
"styleguide_example.admin.apps.AdminConfig",
58+
"styleguide_example.custom_admin.apps.CustomAdminConfig",
5959
"django.contrib.auth",
6060
"django.contrib.contenttypes",
6161
"django.contrib.sessions",

styleguide_example/admin/apps.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

styleguide_example/blog_examples/admin_2fa/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
class AdminSetupTwoFactorAuthView(TemplateView):
8-
template_name = "blog_examples/admin_2fa/setup_mfa.html"
8+
template_name = "admin_2fa/setup_2fa.html"
99

1010
def post(self, request):
1111
context = {}
@@ -16,7 +16,7 @@ def post(self, request):
1616
otp_secret = two_factor_auth_data.otp_secret
1717

1818
context["otp_secret"] = otp_secret
19-
context["qr_code"] = two_factor_auth_data.generate_qr_code(otp_secret=otp_secret, name=user.username)
19+
context["qr_code"] = two_factor_auth_data.generate_qr_code(name=user.email)
2020
except ValidationError as exc:
2121
context["form_errors"] = exc.messages
2222

styleguide_example/blog_examples/templates/admin_2fa/setup_mfa.html renamed to styleguide_example/blog_examples/templates/admin_2fa/setup_2fa.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
{% csrf_token %}
66

77
{% if otp_secret %}
8-
<p>OTP Secret: {{ otp_secret }}</p>
8+
<p><strong>OTP Secret:</strong></p>
9+
<p>{{ otp_secret }}</p>
910
<p>Enter it inside a 2FA app (Google Authenticator, Authy) or scan the QR code below.</p>
1011
{{ qr_code|safe }}
1112
{% else %}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.contrib.admin.apps import AdminConfig as BaseAdminConfig
2+
3+
4+
class CustomAdminConfig(BaseAdminConfig):
5+
default_site = "styleguide_example.custom_admin.sites.AdminSite"

styleguide_example/templates/admin/base_site.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% extends "admin/base_site.html" %}
22

33
{% block userlinks %}
4-
<h1>SHANO</h1>
54
{% if user.is_active and user.is_staff %}
65
<a href="{% url "admin:setup-2fa" %}"> Setup 2FA </a> /
76
{% endif %}

0 commit comments

Comments
 (0)