aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzsloan2020-08-06 13:54:18 -0500
committerzsloan2020-08-06 13:54:18 -0500
commit39f2d8b8599a8daae2c55c3a2bf48366164c6ca2 (patch)
tree4b7d73f3d894706340209f06941dfabaf84addd9
parent85a384dc779a49f02ccee3088356e4873eacbd9a (diff)
downloadgenenetwork2-39f2d8b8599a8daae2c55c3a2bf48366164c6ca2.tar.gz
Added endpoint for changing some user details
* wqflask/wqflask/user_session.py - Added endpoint for /manage/user that lets the user change their full_name or organization. Still need to add something that lets them change their e-mail, since that will require a confirmation
-rw-r--r--wqflask/wqflask/user_session.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/wqflask/wqflask/user_session.py b/wqflask/wqflask/user_session.py
index ba659fe5..3aa2c151 100644
--- a/wqflask/wqflask/user_session.py
+++ b/wqflask/wqflask/user_session.py
@@ -13,7 +13,7 @@ from wqflask import app
from utility import hmac
#from utility.elasticsearch_tools import get_elasticsearch_connection
-from utility.redis_tools import get_redis_conn, get_user_id, get_user_collections, save_collections
+from utility.redis_tools import get_redis_conn, get_user_id, get_user_by_unique_column, set_user_attribute, get_user_collections, save_collections
Redis = get_redis_conn()
from utility.logger import getLogger
@@ -53,6 +53,18 @@ def create_signed_cookie():
logger.debug("uuid_signed:", uuid_signed)
return the_uuid, uuid_signed
+@app.route("/user/manage", methods=('GET','POST'))
+def manage_user():
+ params = request.form if request.form else request.args
+ if 'new_full_name' in params:
+ set_user_attribute(g.user_session.user_id, 'full_name', params['new_full_name'])
+ if 'new_organization' in params:
+ set_user_attribute(g.user_session.user_id, 'organization', params['new_organization'])
+
+ user_details = get_user_by_unique_column("user_id", g.user_session.user_id)
+
+ return render_template("admin/manage_user.html", user_details = user_details)
+
class UserSession(object):
"""Logged in user handling"""