-
-
Notifications
You must be signed in to change notification settings - Fork 445
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add custom domain admin page (#2348)
* Add custom domain admin page * Add domain search
- Loading branch information
Showing
3 changed files
with
244 additions
and
13 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,118 @@ | ||
{% extends 'admin/master.html' %} | ||
|
||
{% macro show_user(user) -%} | ||
<h4>User <a href="/admin/email_search?email={{ user.email }}">{{ user.email }}</a> with ID {{ user.id }}.</h4> | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th scope="col">User ID</th> | ||
<th scope="col">Email</th> | ||
<th scope="col">Verified</th> | ||
<th scope="col">Status</th> | ||
<th scope="col">Paid</th> | ||
<th scope="col">Premium</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>{{ user.id }}</td> | ||
<td> | ||
<a href="/admin/email_search?email={{ user.email }}">{{ user.email }}</a> | ||
</td> | ||
{% if user.activated %} | ||
|
||
<td class="text-success">Activated</td> | ||
{% else %} | ||
<td class="text-warning">Pending</td> | ||
{% endif %} | ||
{% if user.disabled %} | ||
|
||
<td class="text-danger">Disabled</td> | ||
{% else %} | ||
<td class="text-success">Enabled</td> | ||
{% endif %} | ||
<td>{{ "yes" if user.is_paid() else "No" }}</td> | ||
<td>{{ "yes" if user.is_premium() else "No" }}</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
{%- endmacro %} | ||
|
||
|
||
{% macro show_verification(title, expected, errors) -%} | ||
{% if not expected %} | ||
<h4 class="mb-3">{{ title }} <span class="text-success">Verified</span></h4> | ||
{% else %} | ||
<h4 class="mb-3">{{ title }}</h4> | ||
<p>Expected</p> | ||
<p>{{expected}}</p> | ||
<p>Current response</p> | ||
<ul class="list-group"> | ||
{% for error in errors %} | ||
<li class="list-group-item">{{ error }}</li> | ||
{% endfor %} | ||
</ul> | ||
{% endif %} | ||
{%- endmacro %} | ||
|
||
|
||
{% macro show_domain(domain_with_data) -%} | ||
<h3>Domain {{ domain_with_data.domain.domain }}</h3> | ||
{% set domain = domain_with_data.domain %} | ||
<ul class="list-group"> | ||
<li class="list-group-item"> | ||
{{ show_verification("Ownership", domain_with_data.ownership_expected, domain_with_data.ownership_validation.errors) }} | ||
</li> | ||
<li class="list-group-item"> | ||
{{ show_verification("MX", domain_with_data.mx_expected, domain_with_data.mx_validation.errors) }} | ||
</li> | ||
<li class="list-group-item"> | ||
{{ show_verification("SPF", domain_with_data.spf_expected, domain_with_data.spf_validation.errors) }} | ||
</li> | ||
{% for dkim_domain in domain_with_data.dkim_expected %} | ||
<li class="list-group-item"> | ||
{{ show_verification("DKIM {}.{}".format(dkim_domain, domain.domain), domain_with_data.dkim_expected[dkim_domain], [domain_with_data.dkim_validation.get(dkim_domain+"."+domain.domain,'')]) }} | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
{%- endmacro %} | ||
|
||
|
||
{% block body %} | ||
|
||
<div class="border border-dark border-2 mt-1 mb-2 p-3"> | ||
<form method="get"> | ||
<div class="form-group"> | ||
<label for="email">User or domain to search:</label> | ||
<input type="text" | ||
class="form-control" | ||
name="user" | ||
value="{{ query or '' }}" /> | ||
</div> | ||
<button type="submit" class="btn btn-primary">Submit</button> | ||
</form> | ||
</div> | ||
{% if data.no_match and query %} | ||
<div class="border border-dark border-2 mt-1 mb-2 p-3 alert alert-warning" | ||
role="alert">No user, alias or mailbox found for {{ query }}</div> | ||
{% endif %} | ||
{% if data.user %} | ||
<div class="border border-dark border-2 mt-1 mb-2 p-3"> | ||
<h3 class="mb-3">Found User {{ data.user.email }}</h3> | ||
{{ show_user(data.user) }} | ||
</div> | ||
{% endif %} | ||
<div class="d-flex"> | ||
|
||
{% for domain_with_data in data.domains %} | ||
<div class="card m-2 border-dark" style="width: 30rem;"> | ||
<div class="card-body"> | ||
{{ show_domain(domain_with_data) }} | ||
</div> | ||
</div> | ||
{% endfor %} | ||
</div> | ||
|
||
|
||
{% endblock %} |