本文整理汇总了Python中models.User.User.is_email_valid方法的典型用法代码示例。如果您正苦于以下问题:Python User.is_email_valid方法的具体用法?Python User.is_email_valid怎么用?Python User.is_email_valid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.User.User
的用法示例。
在下文中一共展示了User.is_email_valid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: contact_post
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import is_email_valid [as 别名]
def contact_post():
if request.is_xhr:
name = request.form.get('contact-name')
email = request.form.get('contact-email')
message = request.form.get('contact-message')
language = session.get('language', 'en')
if name is not None and User.is_email_valid(email) and message is not None:
aux.send_email('Contact: ' + name, app.config['MAIL_USERNAME'], message + '\nReply to: <' + email + '>')
return strings.STRINGS[language]['CONTACT_MESSAGE_RECEIVED']
else:
return redirect('/404')
示例2: password_reset_post
# 需要导入模块: from models.User import User [as 别名]
# 或者: from models.User.User import is_email_valid [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')