aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grumpy/templates/_userinfo.html15
-rw-r--r--grumpy/templates/layout.html14
2 files changed, 18 insertions, 11 deletions
diff --git a/grumpy/templates/_userinfo.html b/grumpy/templates/_userinfo.html
new file mode 100644
index 0000000..a9827e7
--- /dev/null
+++ b/grumpy/templates/_userinfo.html
@@ -0,0 +1,15 @@
+{% macro show_box(g) -%}
+{% if g.user -%}
+<ul>
+<li>{{ g.user.email.split('@')[0] | e }}
+<li><a href="{{ url_for('logout') }}">Log out</a>
+{% if g.user.regtoken -%}
+<span class="warning">
+Warning: this user account has not yet been confirmed.<br />
+Until the account has been confirmed, You won't receive
+notifications and cannot add packages to your watch list.
+{# TODO: provide link to "request new token" #}
+</span>
+{% endif -%}{# g.user.regtoken #}
+{% endif -%}{# g.user #}
+{% endmacro -%}
diff --git a/grumpy/templates/layout.html b/grumpy/templates/layout.html
index 273a5d3..381e32c 100644
--- a/grumpy/templates/layout.html
+++ b/grumpy/templates/layout.html
@@ -1,20 +1,12 @@
+{% import '_userinfo.html' as userinfo -%}
<!doctype html>
<head>
<title>{% block title %}Welcome{% endblock %} | Grumpy</title>
</head>
-{% if g.user and g.user.regtoken %}
-<span class="warning">
-Warning: this user account has not yet been confirmed.<br />
-Until the account has been confirmed, You won't receive
-notifications and cannot add packages to your watch list.
-{# TODO: provide link to "request new token" #}
-</span>
-{% endif %}
+{{ userinfo.show_box(g) }}
<div class=menu>
<ul>
- {% if g.user %}
- <li><a href="{{ url_for('logout') }}">Log out</a></li>
- {% else %}
+ {% if not g.user %}
<li><a href="{{ url_for('login') }}">Login</a></li>
{% endif %}
</ul>