当前位置: 首页>>代码示例>>Python>>正文


Python User.create_new_user方法代码示例

本文整理汇总了Python中model.User.create_new_user方法的典型用法代码示例。如果您正苦于以下问题:Python User.create_new_user方法的具体用法?Python User.create_new_user怎么用?Python User.create_new_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在model.User的用法示例。


在下文中一共展示了User.create_new_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sign_up

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_new_user [as 别名]
def sign_up():
	user_name = request.form.get('name')
	user_email = request.form.get('email')
	user_password = request.form.get('password')

	new_user = User.create_new_user(user_name, user_email, user_password)
	session['logged_in_user'] = new_user.user_id
	return redirect('/')
开发者ID:ammeurer,项目名称:There_and_Back_Again,代码行数:10,代码来源:server.py

示例2: confirm_new_account

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_new_user [as 别名]
def confirm_new_account():
    """Confirm new account"""

    user_email = request.form.get("email")
    user_password = request.form.get("password1")
    user_phone = request.form.get("phone")

    confirmed_user = User.get_user_by_email(user_email)

    if not confirmed_user:
        hash = sha256_crypt.encrypt(user_password)
        User.create_new_user(user_email, hash, user_phone)
        flash("You successfully created an account! Please log in to get started.", "create_account")
    else:
        flash("You already have an account. Please sign in.", "account_already")

    return redirect("/")
开发者ID:jturn130,项目名称:eatable,代码行数:19,代码来源:server.py

示例3: register_user

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_new_user [as 别名]
def register_user():
    """Registers User"""

    register_email = request.form["email_input"]
    register_password = request.form["password_input"]
    register_username = request.form["username_input"]

    if User.query.filter(User.email == register_email).first():
        flash("A person has already registered with the email")
        return redirect("/")
    elif User.query.filter(User.username == register_username).first():
        flash("A person has already taken that username")
        return redirect("/")
    else:
        if register_email and register_password and register_username:
            User.create_new_user(email=register_email, 
                                password=register_password,
                                username=register_username)
            flash("Thanks for creating an account with Gutenberg Translate! Please sign in")
            return redirect("/")
        else:
            flash("Please fill out all fields")
            return redirect("/")
开发者ID:sodewumi,项目名称:gutenberg_translate,代码行数:25,代码来源:server.py


注:本文中的model.User.create_new_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。