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


Python UserMgr.signup_user方法代码示例

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


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

示例1: testSignupWorks

# 需要导入模块: from bookie.models.auth import UserMgr [as 别名]
# 或者: from bookie.models.auth.UserMgr import signup_user [as 别名]
    def testSignupWorks(self):
        """Signing up stores an activation."""
        email = '[email protected]'
        UserMgr.signup_user(email, 'testcase')

        activations = Activation.query.all()

        self.assertTrue(len(activations) == 1)
        act = activations[0]

        self.assertEqual(email, act.user.email,
            "The activation email is the correct one.")
开发者ID:cambot,项目名称:Bookie,代码行数:14,代码来源:test_signup.py

示例2: signup_process

# 需要导入模块: from bookie.models.auth import UserMgr [as 别名]
# 或者: from bookie.models.auth.UserMgr import signup_user [as 别名]
def signup_process(request):
    """Process the signup request

    If there are any errors drop to the same template with the error
    information.

    """
    params = request.params
    email = params.get('email', None)

    if not email:
        # if still no email, I give up!
        return {
            'errors': {
                'email': 'Please supply an email address to sign up.'
            }
        }

    # first see if the user is already in the system
    exists = UserMgr.get(email=email)
    if exists:
        return {
            'errors': {
                'email': 'The user has already signed up.'
            }
        }

    new_user = UserMgr.signup_user(email, 'signup')
    if new_user:
        # then this user is able to invite someone
        # log it
        AuthLog.reactivate(new_user.username)

        # and then send an email notification
        # @todo the email side of things
        settings = request.registry.settings

        # Add a queue job to send the user a notification email.
        tasks.email_signup_user.delay(
            new_user.email,
            "Enable your Bookie account",
            settings,
            request.route_url(
                'reset',
                username=new_user.username,
                reset_key=new_user.activation.code
            )
        )

        # And let the user know they're signed up.
        return {
            'message': 'Thank you for signing up from: ' + new_user.email
        }
    else:
        return {
            'errors': {
                'email': 'There was an unknown error signing up.'
            }
        }
开发者ID:Cfhansen,项目名称:Bookie,代码行数:61,代码来源:auth.py


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