mirror of
https://github.com/jointakahe/takahe.git
synced 2024-11-26 01:01:00 +00:00
Show domain setup to admins (#568)
Prompts admin users to setup domains on the identity creation
This commit is contained in:
parent
b6d9f1dc95
commit
f256217d1b
2 changed files with 41 additions and 19 deletions
|
@ -3,6 +3,20 @@
|
||||||
{% block title %}Create Identity{% endblock %}
|
{% block title %}Create Identity{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% if no_valid_domains %}
|
||||||
|
{% if user.admin %}
|
||||||
|
<section class="icon-menu">
|
||||||
|
<p class="option empty">There are no domains configured for this user account.</p>
|
||||||
|
<a href="{% url "admin_domains" %}" class="option">
|
||||||
|
<i class="fa-solid fa-list"></i> View domains
|
||||||
|
</a>
|
||||||
|
</section>
|
||||||
|
{% else %}
|
||||||
|
<section>
|
||||||
|
<p class="option empty">There are no domains available for this user account.</p>
|
||||||
|
</section>
|
||||||
|
{% endif %}
|
||||||
|
{% else %}
|
||||||
<form action="." method="POST">
|
<form action="." method="POST">
|
||||||
<h1>Create New Identity</h1>
|
<h1>Create New Identity</h1>
|
||||||
<p>
|
<p>
|
||||||
|
@ -22,4 +36,5 @@
|
||||||
<button>Create</button>
|
<button>Create</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -370,3 +370,10 @@ class CreateIdentity(FormView):
|
||||||
)
|
)
|
||||||
self.request.session["identity_id"] = identity.id
|
self.request.session["identity_id"] = identity.id
|
||||||
return redirect(identity.urls.view)
|
return redirect(identity.urls.view)
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["user"] = self.request.user
|
||||||
|
if len(context["form"].fields["domain"].choices) == 0:
|
||||||
|
context["no_valid_domains"] = True
|
||||||
|
return context
|
||||||
|
|
Loading…
Reference in a new issue