本文整理汇总了Python中gitshell.gsuser.models.GsuserManager.get_useremail_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python GsuserManager.get_useremail_by_id方法的具体用法?Python GsuserManager.get_useremail_by_id怎么用?Python GsuserManager.get_useremail_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gitshell.gsuser.models.GsuserManager
的用法示例。
在下文中一共展示了GsuserManager.get_useremail_by_id方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: email_verified
# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_useremail_by_id [as 别名]
def email_verified(request, token):
useremail_id = cache.get(token + '_useremail_id')
usermail = GsuserManager.get_useremail_by_id(useremail_id)
if usermail and usermail.is_verify == 0 and usermail.user_id == request.user.id:
usermail.is_verify = 1
usermail.save()
return HttpResponseRedirect('/settings/emails/')
示例2: email_verify
# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_useremail_by_id [as 别名]
def email_verify(request, eid):
usermail = GsuserManager.get_useremail_by_id(eid)
email = usermail.email
via = ''
if usermail and usermail.is_verify == 0 and usermail.user_id == request.user.id:
Mailer().send_verify_email(request.user, eid, email)
email_suffix = email.split('@')[-1]
if email_suffix in COMMON_EMAIL_DOMAIN:
via = COMMON_EMAIL_DOMAIN[email_suffix]
return json_httpResponse({'code': 200, 'message': u'请尽快验证邮箱', 'via': via})
return json_httpResponse({'code': 500, 'message': u'邮箱不对,或者没有相关权限', 'via': via})
示例3: email_primary
# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_useremail_by_id [as 别名]
def email_primary(request, eid):
usermail = GsuserManager.get_useremail_by_id(eid)
if not usermail or usermail.user_id != request.user.id:
return json_failed(500, u'设置失败,没有权限')
useremails = GsuserManager.list_useremail_by_userId(request.user.id)
for x in useremails:
if usermail.id != x.id and x.is_primary == 1:
x.is_primary = 0
x.save()
usermail.is_primary = 1
usermail.save()
return json_success(u'成功设置默认邮箱 %s' % usermail.email)
示例4: email_remove
# 需要导入模块: from gitshell.gsuser.models import GsuserManager [as 别名]
# 或者: from gitshell.gsuser.models.GsuserManager import get_useremail_by_id [as 别名]
def email_remove(request, eid):
usermail = GsuserManager.get_useremail_by_id(eid)
if usermail and usermail.user_id == request.user.id:
usermail.visibly = 1
usermail.save()
return json_success(u'成功删除邮箱 %s' % usermail.email)