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


Python User.create_user方法代码示例

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


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

示例1: register

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
def register():
    """Registers user as a user of the app."""
    # TODO: Add error handling for duplicate email
    # TODO: Form validation
    email = request.form.get('email')
    password = request.form.get('password')
    User.create_user(email, password)

    return redirect('/')
开发者ID:aninahpets,项目名称:RestaurantRides,代码行数:11,代码来源:server.py

示例2: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
 def post(self):
     username = self.get_argument('username', None)
     password = self.get_argument('password', None)
     password_repeat = self.get_argument('password-repeat', None)
     email = self.get_argument('email', None)
     homepage = self.get_argument('homepage', None)
     if not all([username, password, password_repeat, email]):
         return self.write(u'信息填写不全')
     if password != password_repeat:
         return self.write(u'两次输入的密码不相同!')
     user = User.get_item('name', username) or User.get_item('email', email)
     if user:
         return self.write(u'用户已经存在!')
     else:
         User.create_user(username, password, email, 5, homepage)
         return self.redirect('/')
开发者ID:Syndim,项目名称:Simple,代码行数:18,代码来源:account.py

示例3: process_sign_up_form

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
def process_sign_up_form():
    """New user sign up process"""

    #Get sign up form variables
    username = request.form["username"]
    user_password = request.form["password"]
    user_email = request.form["email"]

    user_confirmed = User.get_user_via_email(user_email)

    if not user_confirmed:
        User.create_user(username, user_password, user_email)
        flash("Your account has been created successfully, please sign in")
    else:
        flash("you already have an account, please sign in.")

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

示例4: handle_register

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
def handle_register():
    """Handles input from registration form."""

    email = request.form.get("email")
    password = request.form.get("password")
    fname = request.form.get("first-name")
    lname = request.form.get("last-name")

    user = User.query_by_email(email)

    if user:
        flash("That email has already been registered.")
        return redirect("/register")

    else:
        # If the user doesn't exist, create one.
        User.create_user(email, password, fname, lname)

        #Code 307 preserves the POST request, including form data.
        return redirect("/login", code=307)
开发者ID:rayramsay,项目名称:roadcast,代码行数:22,代码来源:server.py

示例5: post

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
    def post(self):
        username = self.request.get('username')
        password = self.request.get('password')
        verify = self.request.get('verify')
        errors = self.get_errors(username, password, verify)

        if errors:
            self.render('signup.html', errors=errors)
        else:
            user = User.create_user(username=username, raw_password=password)            
            self.auth.set_session(self.auth.store.user_to_dict(user))

            self.session['first_login'] = True
            self.redirect('/profile')
开发者ID:yeonhoyoon,项目名称:atlantis,代码行数:16,代码来源:handlers.py

示例6: get

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
    def get(self):
        for i in range(15):
            user = User.create_user(username='snudatetest' + str(i), raw_password='1234')
            user.name = '김개똥' + str(i)
            user.phone = '01012345678'
            user.nickname = '사용자' + str(i)
            user.tags = [u'예쁘고', u'착하고', u'똑똑한']
            user.profile = """
그대가 돌아서면 두 눈이 마주칠까
심장이 Bounce Bounce 두근대 들릴까 봐 겁나

한참을 망설이다 용기를 내
밤새워 준비한 순애보 고백해도 될까

처음 본 순간부터 네 모습이 
내 가슴 울렁이게 만들었어
Baby You're my trampoline
You make me Bounce Bounce

수많은 인연과 바꾼 너인 걸
사랑이 남긴 상처들도 감싸줄게

어쩌면 우린 벌써 알고 있어
그토록 찾아 헤맨 사랑의 꿈
외롭게만 하는 걸
You make me Bounce You make me Bounce

Bounce Bounce
망설여져 나 혼자만의 감정일까
내가 잘못 생각한 거라면 어떡하지 눈물이나

별처럼 반짝이는 눈망울도
수줍어 달콤하던 네 입술도
내겐 꿈만 같은 걸
You make me Bounce

어쩌면 우린 벌써 알고 있어
그토록 찾아 헤맨 사랑의 꿈
외롭게만 하는 걸 어쩌면 우린 벌써
You make me~ You make me~"""

            user.profile_uuid = str(uuid.uuid1())
            user.verified = True
            user.put()

        self.response.write('success')
开发者ID:yeonhoyoon,项目名称:atlantis,代码行数:48,代码来源:handlers.py

示例7: add_user

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
 def add_user(self, username, password, gender, email, **kw):
     User.create_user(username, password, gender, email)
     return 'add user success'
开发者ID:liuke80,项目名称:LemonPy,代码行数:5,代码来源:user.py

示例8: get_pin

# 需要导入模块: from model import User [as 别名]
# 或者: from model.User import create_user [as 别名]
if __name__ == '__main__':

    # Start locker
    while True:

        if pi_present:
            pin = get_pin(4)
        else:
            pin = raw_input('Locker Idle. Enter Unique PIN:')

        if pin == '1111':
            model.drop_tables()
            sys.exit()

        chamber = locker.find_chamber_by_pin(pin)

        if chamber:
            chamber.release()

        else:
            chamber = locker.find_available_chamber()
            if chamber:
                user = User.create_user(pin)
                chamber.reserve(user)

            else:
                print('Chambers Full. Wait for relase.')

        print('New Status: ', locker)
开发者ID:gtalarico,项目名称:locker,代码行数:31,代码来源:locker.py


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