diff --git a/aurweb/routers/accounts.py b/aurweb/routers/accounts.py index fc25a7e8..8eecaa31 100644 --- a/aurweb/routers/accounts.py +++ b/aurweb/routers/accounts.py @@ -451,6 +451,13 @@ async def account(request: Request, username: str): k = user.PGPKey or str() 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. return render_template(request, "account/show.html", context) diff --git a/templates/account/show.html b/templates/account/show.html index e1074394..c6a53f4a 100644 --- a/templates/account/show.html +++ b/templates/account/show.html @@ -50,7 +50,17 @@ {% trans %}Status{% endtrans %}: - {{ "Active" if not user.Suspended else "Suspended" | tr }} + {% if not user.InactivityTS %} + {{ "Active" | tr }} + {% else %} + {% set inactive_ds = user.InactivityTS | dt | as_timezone(timezone) %} + + {{ + "Inactive since %s" | tr + | format(inactive_ds.strftime("%Y-%m-%d %H:%M")) + }} + + {% endif %} {% trans %}Registration date{% endtrans %}: @@ -58,6 +68,13 @@ {{ user.RegistrationTS.strftime("%Y-%m-%d") }} + {% if login_ts %} + + {% trans %}Last Login{% endtrans %}: + {% set login_ds = login_ts | dt | as_timezone(timezone) %} + {{ login_ds.strftime("%Y-%m-%d") }} + + {% endif %} {% trans %}Links{% endtrans %}: