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
|
@ -3,23 +3,38 @@
|
||||||
{% block title %}Create Identity{% endblock %}
|
{% block title %}Create Identity{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form action="." method="POST">
|
{% if no_valid_domains %}
|
||||||
<h1>Create New Identity</h1>
|
{% if user.admin %}
|
||||||
<p>
|
<section class="icon-menu">
|
||||||
You can have multiple identities - they are totally separate, and share
|
<p class="option empty">There are no domains configured for this user account.</p>
|
||||||
nothing apart from your login details. They can also be shared among multiple
|
<a href="{% url "admin_domains" %}" class="option">
|
||||||
users, so you can use them for company or project accounts.
|
<i class="fa-solid fa-list"></i> View domains
|
||||||
</p>
|
</a>
|
||||||
{% csrf_token %}
|
</section>
|
||||||
<fieldset>
|
{% else %}
|
||||||
<legend>Identity Details</legend>
|
<section>
|
||||||
{% include "forms/_field.html" with field=form.username %}
|
<p class="option empty">There are no domains available for this user account.</p>
|
||||||
{% include "forms/_field.html" with field=form.domain %}
|
</section>
|
||||||
{% include "forms/_field.html" with field=form.name %}
|
{% endif %}
|
||||||
{% include "forms/_field.html" with field=form.discoverable %}
|
{% else %}
|
||||||
</fieldset>
|
<form action="." method="POST">
|
||||||
<div class="buttons">
|
<h1>Create New Identity</h1>
|
||||||
<button>Create</button>
|
<p>
|
||||||
</div>
|
You can have multiple identities - they are totally separate, and share
|
||||||
</form>
|
nothing apart from your login details. They can also be shared among multiple
|
||||||
|
users, so you can use them for company or project accounts.
|
||||||
|
</p>
|
||||||
|
{% csrf_token %}
|
||||||
|
<fieldset>
|
||||||
|
<legend>Identity Details</legend>
|
||||||
|
{% include "forms/_field.html" with field=form.username %}
|
||||||
|
{% include "forms/_field.html" with field=form.domain %}
|
||||||
|
{% include "forms/_field.html" with field=form.name %}
|
||||||
|
{% include "forms/_field.html" with field=form.discoverable %}
|
||||||
|
</fieldset>
|
||||||
|
<div class="buttons">
|
||||||
|
<button>Create</button>
|
||||||
|
</div>
|
||||||
|
</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 New Issue