Now updating userinfo take effects immediately
Change background color of profile and signout button
This commit is contained in:
parent
1936fb6ce4
commit
e9dfd7b395
|
@ -77,7 +77,7 @@
|
||||||
<!-- Menu Body -->
|
<!-- Menu Body -->
|
||||||
|
|
||||||
<!-- Menu Footer-->
|
<!-- Menu Footer-->
|
||||||
<li class="user-footer">
|
<li class="user-footer" style="background-color:#e6e6e6">
|
||||||
<div class="pull-left">
|
<div class="pull-left">
|
||||||
<a href="/user/info/" class="btn btn-default btn-flat">Profile</a>
|
<a href="/user/info/" class="btn btn-default btn-flat">Profile</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from webViews.view import normalView
|
from webViews.view import normalView
|
||||||
from webViews.authenticate.auth import is_authenticated
|
from webViews.authenticate.auth import is_authenticated
|
||||||
from webViews.dockletrequest import dockletRequest
|
from webViews.dockletrequest import dockletRequest
|
||||||
from flask import redirect, request, render_template, session, make_response
|
from flask import redirect, request, render_template, session, make_response, abort
|
||||||
from webViews import cookie_tool
|
from webViews import cookie_tool
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
@ -20,16 +20,18 @@ if (env.getenv('EXTERNAL_LOGIN') == 'True'):
|
||||||
import external_generate
|
import external_generate
|
||||||
|
|
||||||
def refreshInfo():
|
def refreshInfo():
|
||||||
'''not used now'''
|
data = {}
|
||||||
result = dockletRequest.post('/login/', data)
|
result = dockletRequest.post('/user/selfQuery/', data)
|
||||||
ok = result and result.get('success', None)
|
ok = result and result.get('success', None)
|
||||||
session['username'] = request.form['username']
|
if (ok and ok == "true"):
|
||||||
|
session['username'] = result['data']['username']
|
||||||
session['nickname'] = result['data']['nickname']
|
session['nickname'] = result['data']['nickname']
|
||||||
session['description'] = result['data']['description'][0:10]
|
session['description'] = result['data']['description']
|
||||||
session['avatar'] = '/static/avatar/'+ result['data']['avatar']
|
session['avatar'] = '/static/avatar/'+ result['data']['avatar']
|
||||||
session['usergroup'] = result['data']['group']
|
session['usergroup'] = result['data']['group']
|
||||||
session['status'] = result['data']['status']
|
session['status'] = result['data']['status']
|
||||||
session['token'] = result['data']['token']
|
else:
|
||||||
|
abort(404)
|
||||||
|
|
||||||
class loginView(normalView):
|
class loginView(normalView):
|
||||||
template_path = "login.html"
|
template_path = "login.html"
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
from flask import redirect, request
|
from flask import redirect, request
|
||||||
from webViews.dockletrequest import dockletRequest
|
from webViews.dockletrequest import dockletRequest
|
||||||
|
from webViews.authenticate import login
|
||||||
from webViews.view import normalView
|
from webViews.view import normalView
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
@ -15,4 +16,5 @@ class userinfoView(normalView):
|
||||||
@classmethod
|
@classmethod
|
||||||
def post(self):
|
def post(self):
|
||||||
result = json.dumps(dockletRequest.post('/user/selfModify/', request.form))
|
result = json.dumps(dockletRequest.post('/user/selfModify/', request.form))
|
||||||
|
login.refreshInfo()
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue