本文整理汇总了Python中models.Account.create_account方法的典型用法代码示例。如果您正苦于以下问题:Python Account.create_account方法的具体用法?Python Account.create_account怎么用?Python Account.create_account使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Account
的用法示例。
在下文中一共展示了Account.create_account方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: verify_mail
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import create_account [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: do_sign_up
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import create_account [as 别名]
def do_sign_up(request, form_data, package=None, invitation=None):
dt = datetime.datetime.now()
email = form_data.get('email')
password = form_data.get('password')
account, pfu = Account.create_account(dt, email, password)
if invitation:
invitation.account = account
invitation.save()
account.apply_package(invitation.forced_package)
else:
account.apply_package(package)
account.save()
user = auth.authenticate(username=pfu.user.username, password=password)
auth.login(request, user)
return account
示例3: create_account
# 需要导入模块: from models import Account [as 别名]
# 或者: from models.Account import create_account [as 别名]
def create_account(request, email, package):
dt = datetime.datetime.now()
account, pfu = Account.create_account(dt, email)
account.apply_package(package)
# Demo index creation
account.create_demo_index()
if account.package.base_price == 0:
account.status = Account.Statuses.operational
mail.report_new_account(account)
account.save()
password=account.apikey.split('-', 1)[1]
user = auth.authenticate(username=pfu.user.username, password=password)
auth.login(request, user)
send_mail('Welcome to IndexTank!', 'Thanks signing-up for IndexTank!\nYour password for logging in to your dashboard is %s' % (password), 'IndexTank <[email protected]>', [email], fail_silently=False)
return account