Skip to content

Commit

Permalink
Add domain search
Browse files Browse the repository at this point in the history
  • Loading branch information
acasajus committed Dec 19, 2024
1 parent 4a09a15 commit f2e3b3d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
4 changes: 4 additions & 0 deletions app/admin_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,10 @@ def index(self):
user = User.get_by(id=user_id)
except ValueError:
user = User.get_by(email=query)
if user is None:
cd = CustomDomain.get_by(domain=query)
if cd is not None:
user = cd.user
search = CustomDomainSearchResult.from_user(user)
print("NEW", search.domains)

Expand Down
21 changes: 11 additions & 10 deletions templates/admin/custom_domain_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ <h4>User <a href="/admin/email_search?email={{ user.email }}">{{ user.email }}</
<h4 class="mb-3">{{ title }} <span class="text-success">Verified</span></h4>
{% else %}
<h4 class="mb-3">{{ title }}</h4>
<p>Expected {{expected}}</p>
<p>Current response</p>
<ul class="list-group">
{% for error in errors %}
<li class="list-group-item">{{ error }}</li>
{% endfor %}
</ul>
<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 %}

Expand All @@ -70,7 +71,7 @@ <h3>Domain {{ domain_with_data.domain.domain }}</h3>
</li>
{% for dkim_domain in domain_with_data.dkim_expected %}
<li class="list-group-item">
{{ show_verification("DKIM {}".format(dkim_domain), domain_with_data.dkim_expected[dkim_domain], [domain_with_data.dkim_validation.get(dkim_domain+"."+domain.domain,'')]) }}
{{ 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>
Expand All @@ -83,7 +84,7 @@ <h3>Domain {{ domain_with_data.domain.domain }}</h3>
<div class="border border-dark border-2 mt-1 mb-2 p-3">
<form method="get">
<div class="form-group">
<label for="email">User to search:</label>
<label for="email">User or domain to search:</label>
<input type="text"
class="form-control"
name="user"
Expand All @@ -105,7 +106,7 @@ <h3 class="mb-3">Found User {{ data.user.email }}</h3>
<div class="d-flex">

{% for domain_with_data in data.domains %}
<div class="card m-2" style="width: 30rem;">
<div class="card m-2 border-dark" style="width: 30rem;">
<div class="card-body">
{{ show_domain(domain_with_data) }}
</div>
Expand Down

0 comments on commit f2e3b3d

Please sign in to comment.