mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
fix(python): add logged in date field to account/show.html
Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
2ea4559b60
commit
224a0de784
2 changed files with 14 additions and 1 deletions
|
@ -451,6 +451,13 @@ async def account(request: Request, username: str):
|
||||||
k = user.PGPKey or str()
|
k = user.PGPKey or str()
|
||||||
context["pgp_key"] = " ".join([k[i:i + 4] for i in range(0, len(k), 4)])
|
context["pgp_key"] = " ".join([k[i:i + 4] for i in range(0, len(k), 4)])
|
||||||
|
|
||||||
|
login_ts = None
|
||||||
|
session = db.query(models.Session).filter(
|
||||||
|
models.Session.UsersID == user.ID).first()
|
||||||
|
if session:
|
||||||
|
login_ts = user.session.LastUpdateTS
|
||||||
|
context["login_ts"] = login_ts
|
||||||
|
|
||||||
# Render the template.
|
# Render the template.
|
||||||
return render_template(request, "account/show.html", context)
|
return render_template(request, "account/show.html", context)
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,6 @@
|
||||||
}}
|
}}
|
||||||
</td>
|
</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td>{{ "Active" if not user.Suspended else "Suspended" | tr }}</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans %}Registration date{% endtrans %}:</th>
|
<th>{% trans %}Registration date{% endtrans %}:</th>
|
||||||
|
@ -69,6 +68,13 @@
|
||||||
{{ user.RegistrationTS.strftime("%Y-%m-%d") }}
|
{{ user.RegistrationTS.strftime("%Y-%m-%d") }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if login_ts %}
|
||||||
|
<tr>
|
||||||
|
<th>{% trans %}Last Login{% endtrans %}:</th>
|
||||||
|
{% set login_ds = login_ts | dt | as_timezone(timezone) %}
|
||||||
|
<td>{{ login_ds.strftime("%Y-%m-%d") }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
<tr>
|
<tr>
|
||||||
<th>{% trans %}Links{% endtrans %}:</th>
|
<th>{% trans %}Links{% endtrans %}:</th>
|
||||||
<td>
|
<td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue