本文整理汇总了Python中models.User.User.select_by_email方法的典型用法代码示例。如果您正苦于以下问题:Python User.select_by_email方法的具体用法?Python User.select_by_email怎么用?Python User.select_by_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.User.User
的用法示例。
在下文中一共展示了User.select_by_email方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: invite_post
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import select_by_email [as 别名]
def invite_post(tale_id):
username = request.form.get('invite-username', '')
user = User.select_by_email(username, 1)
tale = Tale.select_by_id(tale_id, 1)
if len(user) is 0:
user = User.select_by_full_username(username, 1)
if len(user) is not 0 and len(tale) is not 0 and session.get('user_logged_id', None) is tale[0]['creator_id']:
user = user[0]
tale = tale[0]
new_invitation = Invitation(session['user_logged_id'], user['id'], tale_id)
new_invitation.insert()
creator = User.select_by_id(tale['creator_id'], 1)[0]
email_object = strings.construct_tale_invitation_email_object(
session.get('language', 'en'),
user,
tale,
creator
)
aux.send_email(email_object['title'], user['email'], email_object['body'])
return redirect('/tale/' + str(tale_id) + '/0')
示例2: password_reset_post
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import select_by_email [as 别名]
def password_reset_post():
if request.is_xhr:
email = request.form.get('password-reset-email', '')
user = User.select_by_email(email, 1)
if len(user) is not 0 and User.is_email_valid(email):
user = user[0]
language = session.get('language', 'en')
Password_Change_Requests.delete(user['id'])
p_c_r = Password_Change_Requests(user['id'])
p_c_r.insert()
email_object = strings.construct_password_reset_email_object(
language,
p_c_r.id
)
aux.send_email(email_object['title'], email, email_object['body'])
return jsonify(message = strings.STRINGS[language]['RESET_PASSWORD_MESSAGE'] + ' ' + email)
else:
return redirect('/404')