本文整理汇总了Python中models.Account.insert_verify_email方法的典型用法代码示例。如果您正苦于以下问题:Python Account.insert_verify_email方法的具体用法?Python Account.insert_verify_email怎么用?Python Account.insert_verify_email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.insert_verify_email方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_mail
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import insert_verify_email [as 别名]
def verify_mail():
"""
"""
account_obj = _get_account_by_email(g._db, request.form.get('email', ''))
if account_obj:
raise MainException.ACCOUNT_DUPLICATE
email = request.form.get('email', '')
password = request.form.get('password', '')
password = generate_password_hash(password)
code = random_ascii_string(40)
account_id = Account.gen_id(g._db)
send_verify_email(email, code, email_cb=url_for('account.register_valid', code='', _external=True))
Account.insert_verify_email(g._db, email, code, EmailUsageType.DEVELOPER_VERIFY, account_id)
Account.create_account(g._db, account_id, email, password, 0, RoleType.DEVELOPER)
if 'user' not in session:
session['user'] = {}
session['user']['id'] = account_id
session['user']['email'] = email
session['user']['email_checked'] = 0
session['user']['role'] = RoleType.DEVELOPER
account = {
"id":account_id,
"email":email,
"email_checked":0,
"role":RoleType.DEVELOPER
}
return send_response(account)
示例2: verify_email
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import insert_verify_email [as 别名]
def verify_email():
"""
"""
account_obj = _get_account(g._db)
if not account_obj:
raise MainException.ACCOUNT_NOT_FOUND
if account_obj.get('email_checked'):
raise MainException.ACCOUNT_EMAIL_CHECKED
code = random_ascii_string(40)
email = account_obj.get('email')
send_verify_email(email, code, url_for('account.register_valid', code='', _external=True))
Account.insert_verify_email(g._db, email, code, EmailUsageType.DEVELOPER_VERIFY, account_obj.get('id'))
return MainException.OK
示例3: reset_mail
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import insert_verify_email [as 别名]
def reset_mail():
"""
"""
email = request.form.get('email', '')
if not email:
raise MainException.ACCOUNT_NOT_FOUND
account_obj = _get_account_by_email(g._db, email)
if not account_obj:
raise MainException.ACCOUNT_NOT_FOUND
count = Account.get_verify_count(g._db, email)
if count > 5:
raise MainException.EMAIL_TOO_OFTEN
code = random_ascii_string(40)
send_reset_email(email, code, url_for('web.password_forget_check', mail=email, code='', _external=True))
Account.insert_verify_email(g._db, email, code, EmailUsageType.DEVELOPER_RESET_PWD, account_obj['id'])
return MainException.OK