aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/templates/base.html16
-rw-r--r--wqflask/wqflask/user_session.py10
2 files changed, 18 insertions, 8 deletions
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index ad2e3744..9b75b452 100644
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -106,22 +106,22 @@
<li><a href="https://github.com/genenetwork/genenetwork2/blob/testing/doc/API_readme.md">REST API Documentation</a></li>
</ul>
</li>
- <li class="">
- {% if g.user_session.logged_in %}
- <a id="login_out" title="Signed in as {{ g.user_session.user_name }}" href="/n/logout">Sign out</a>
- {% else %}
- <a id="login_in" href="/n/login">Sign in</a>
- {% endif %}
- </li>
{% if g.user_session.logged_in %}
<li class="">
- <a href="/edit_account_settings" class="dropdow-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">User Account Settings<span class="caret"></a>
+ <a href="/edit_account_settings" class="dropdow-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{% if g.user_session.user_email %}{{ g.user_session.user_email }}{% else %}User Account Settings{% endif %}<span class="caret"></a>
<ul class="dropdown-menu">
<li><a id="manage_user" title="User Options" href="/user/manage">User Options</a></li>
<li><a id="manage_groups" title="Manage Groups" href="/groups/manage">Manage Groups</a></li>
</ul>
</li>
{% endif %}
+ <li class="">
+ {% if g.user_session.logged_in %}
+ <a id="login_out" title="Signed in as {{ g.user_session.user_name }}" href="/n/logout">Sign out</a>
+ {% else %}
+ <a id="login_in" href="/n/login">Sign in</a>
+ {% endif %}
+ </li>
{% endif %}
<!--
<li style="margin-left: 20px;">
diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py
index cef50cd9..5cc898ea 100644
--- a/wqflask/wqflask/user_session.py
+++ b/wqflask/wqflask/user_session.py
@@ -122,6 +122,7 @@ class UserSession:
else:
if user_cookie:
self.logged_in = True
+ self.user_details = get_user_by_unique_column("user_id", self.user_id)
if user_cookie:
session_time = THREE_DAYS
@@ -144,6 +145,15 @@ class UserSession:
return self.record[b'user_id']
@property
+ def user_email(self):
+ """Shortcut to the user email address"""
+
+ if self.logged_in:
+ return self.user_details['email_address']
+ else:
+ return None
+
+ @property
def redis_user_id(self):
"""User id from Redis (need to check if this is the same as the id stored in self.records)"""