本文整理汇总了Python中model.user.User.get_by_email方法的典型用法代码示例。如果您正苦于以下问题:Python User.get_by_email方法的具体用法?Python User.get_by_email怎么用?Python User.get_by_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类model.user.User
的用法示例。
在下文中一共展示了User.get_by_email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
def post(self):
name = self.get_argument('name', '')
email = self.get_argument('email', '')
password = self.get_argument('password', '')
if not name or len(name) > 15:
self.render('join.html', error=111, name=name, email=email)
return
match = re.search(r'[\w.-][email protected][\w.-]+', email)
if not match:
self.render('join.html', error=112, name=name, email=email)
return
if not password:
self.render('join.html', error=110, name=name, email=email)
return
user = User.get_by_email(email)
if user:
self.render('join.html', error=113, name=name, email=email)
return
user = User.new(name, email)
if user:
user.update_password(encrypt(password))
else:
self.render('join.html', error=114)
self.set_secure_cookie('user', user.id, expires_days=30)
self.redirect(self.get_argument('next', '/'))
示例2: post
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
def post(self):
username = self.get_argument('username', '')
email = self.get_argument('email', '')
password = self.get_argument('password', '')
if not username or len(username) > 15:
self.render('home/register.html', error=111, username=username, email=email)
return
match = re.search(r'[\w.-][email protected][\w.-]+', email)
if not match:
self.render('home/register.html', error=113, username=username, email=email)
return
if not password:
self.render('home/register.html', error=110, username=username, email=email)
return
user = User.get_by_username(username)
if user:
self.render('home/register.html', error=112, username=username, email=email)
return
user = User.get_by_email(email)
if user:
self.render('home/register.html', error=114, username=username, email=email)
return
#走代理获取ip方式
reg_ip = self.request.headers['X-Real-Ip']
user = User.new(username, email, password, reg_ip)
if user:
self.set_secure_cookie('user_id', str(user.user_id), expires_days=30)
self.redirect(self.get_argument('next', '/'))
else:
self.render('home/register.html', error=115)
示例3: update_attrs
# 需要导入模块: from model.user import User [as 别名]
# 或者: from model.user.User import get_by_email [as 别名]
def update_attrs(doc_id, **kwargs):
#either replace the entire list or add a new entry to the list
document = get_by_id(doc_id)
build_suggestions = NAME in kwargs
new_fields = {}
new_fields[NAME] = kwargs.get(NAME, document.name)
if not build_suggestions:
new_fields[SUGGESTIONS] = document.suggestions
else:
new_fields['other_names'] = _get_third_party_names(User.get_by_email(doc_id))
_create(doc_id,**new_fields)