本文整理汇总了Python中app.helpers.data.DataManager.create_user方法的典型用法代码示例。如果您正苦于以下问题:Python DataManager.create_user方法的具体用法?Python DataManager.create_user怎么用?Python DataManager.create_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.helpers.data.DataManager
的用法示例。
在下文中一共展示了DataManager.create_user方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: register_view
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import create_user [as 别名]
def register_view():
if request.method == 'GET':
return render_template('gentelella/users/login/register.html')
if request.method == 'POST':
logging.info("Registration under process")
s = get_serializer()
data = [request.form['email'], request.form['password']]
user = DataManager.create_user(data)
form_hash = s.dumps([request.form['email'], str_generator()])
link = url_for('.create_account_after_confirmation_view', hash=form_hash, _external=True)
send_email_confirmation(request.form, link)
login.login_user(user)
record_user_login_logout('user_login', user)
logging.info('logged successfully')
user_logged_in(user)
return redirect(intended_url())
示例2: get_or_create_user_by_email
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import create_user [as 别名]
def get_or_create_user_by_email(email, data=None):
user = DataGetter.get_user_by_email(email, True)
if not user:
password = binascii.b2a_hex(os.urandom(4))
user_data = [email, password]
user = DataManager.create_user(user_data)
send_email_after_account_create_with_password({
'email': email,
'password': password
})
if not user.user_detail:
user_detail = UserDetail(firstname=data['firstname'], lastname=data['lastname'])
user.user_detail = user_detail
save_to_db(user)
return user
示例3: create
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import create_user [as 别名]
def create(self, data):
data = self.validate(data)
user = DataManager.create_user([data['email'], data['password']])
return user
示例4: create_user
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import create_user [as 别名]
def create_user(email, password, is_verified=True):
"""
Registers the user but not logs in
"""
DataManager.create_user([email, password], is_verified=is_verified)
示例5: create_super_admin
# 需要导入模块: from app.helpers.data import DataManager [as 别名]
# 或者: from app.helpers.data.DataManager import create_user [as 别名]
def create_super_admin(email, password):
user = DataManager.create_user([email, password], is_verified=True)
user.is_super_admin = True
user.is_admin = True
save_to_db(user, "User updated")
return user