diff options
author | zsloan | 2022-03-31 16:03:50 +0000 |
---|---|---|
committer | zsloan | 2022-03-31 16:03:50 +0000 |
commit | d6f628fed79f63951e2b3c1c30606d0517b8fb33 (patch) | |
tree | e4d2d8dc6f0b0f011082bbbcc17aca7ef00edf4c /wqflask | |
parent | 9774e0b4335c85f36707a30debde8a4546bb30f0 (diff) | |
download | genenetwork2-d6f628fed79f63951e2b3c1c30606d0517b8fb33.tar.gz |
Replace 'User Account Settings' with user's e-mail and add user_email
property to user_session
Also changed the order of the dropdowns to have Sign Out after the user
drop-down, to more closely match NCBI's style
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/templates/base.html | 16 | ||||
-rw-r--r-- | wqflask/wqflask/user_session.py | 10 |
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)""" |