本文整理汇总了Python中serverside.session.Session.get_email方法的典型用法代码示例。如果您正苦于以下问题:Python Session.get_email方法的具体用法?Python Session.get_email怎么用?Python Session.get_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serverside.session.Session
的用法示例。
在下文中一共展示了Session.get_email方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from serverside.session import Session [as 别名]
# 或者: from serverside.session.Session import get_email [as 别名]
def get(self):
"""
Verify that specified user exists for given account
"""
current_session = Session().get_current_session(self)
email = current_session.get_email()
edit_user = self.request.get("name")
""" Generate links to see each widget for user """
import hashlib
userhash = hashlib.sha1(email + '---' + edit_user).hexdigest()
trophy_case_widget_url = "/api/1/getwidget?widget=trophy_case&u=" + userhash
points_widget_url = "/api/1/getwidget?widget=points&u=" + userhash
rank_widget_url = "/api/1/getwidget?widget=rank&u=" + userhash
milestones_widget_url = "/api/1/getwidget?widget=milestones&u=" + userhash
template_values = {'users_edit' : True,
'account_name' : current_session.get_email(),
'editusername': edit_user,
'view_trophy_case':trophy_case_widget_url,
'view_points':points_widget_url,
'view_rank':rank_widget_url,
'view_milestones':milestones_widget_url}
self.response.out.write(template.render(constants.TEMPLATE_PATHS.CONSOLE_DASHBOARD, template_values))
示例2: post
# 需要导入模块: from serverside.session import Session [as 别名]
# 或者: from serverside.session.Session import get_email [as 别名]
def post(self):
""" will handle change of password request, will return success/fail """
current_session = Session().get_current_session(self)
email = current_session.get_email()
old_password = self.request.get("oldpassword")
new_password = self.request.get("newpassword")
new_password_again = self.request.get("newpasswordagain")
error_message = ""
success = False
if new_password != new_password_again:
error_message = "Passwords do not match."
else:
""" Make sure that the account authenticates... this is a redundant check """
if accounts_dao.authenticate_web_account(email, old_password):
changed = accounts_dao.change_account_password(email, new_password)
if changed:
success = True
else:
error_message = "Old password incorrect."
template_values = {"preferences_main" : True,
"password_change_attempted" : True,
'account_name' : email,
"error_message": error_message,
"password_changed" : success}
self.response.out.write(template.render(constants.TEMPLATE_PATHS.CONSOLE_DASHBOARD, template_values))
示例3: get
# 需要导入模块: from serverside.session import Session [as 别名]
# 或者: from serverside.session.Session import get_email [as 别名]
def get(self):
self.response.out.write("You should be able to see this page, logged in or not...")
sess = Session().get_current_session(self)
if sess == None:
self.response.out.write("<br/>You are not logged in!!")
else:
self.response.out.write("<br/>You are logged in as:")
email = sess.get_email()
self.response.out.write("<br/>" + email)
示例4: get
# 需要导入模块: from serverside.session import Session [as 别名]
# 或者: from serverside.session.Session import get_email [as 别名]
def get(self):
""" Render users template """
current_session = Session().get_current_session(self)
email = current_session.get_email()
error = self.request.get("error")
has_error = False
if error:
has_error = True
error = getErrorString(error)
email = current_session.get_email()
account = current_session.get_account_entity()
badges = badges_dao.get_rendereable_badgeset(account)
template_values = {'users_main': True,
'account_name': email,
'badges':badges,
'has_error': has_error,
'error': error}
self.response.out.write(template.render(constants.TEMPLATE_PATHS.CONSOLE_DASHBOARD, template_values))
示例5: check_login
# 需要导入模块: from serverside.session import Session [as 别名]
# 或者: from serverside.session.Session import get_email [as 别名]
def check_login(self, *args):
if self.request.method != 'GET' and self.request.method != 'POST':
self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, None))
else:
user_session = Session().get_current_session(self)
if user_session == None:
self.response.out.write(template.render(TEMPLATE_PATHS.CONSOLE_LOGIN, None))
else:
logging.info("LEGIT user session! Email: " + user_session.get_email())
handler_method(self, *args)