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


Python UserModel.check_password方法代码示例

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


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

示例1: test_registration_no_sites

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration_no_sites(self):
        """
        Registration still functions properly when
        ``django.contrib.sites`` is not installed; the fallback will
        be a ``RequestSite`` instance.

        """
        Site._meta.installed = False

        resp = self.client.post(reverse('registration_register'),
                                data={'username': 'bob',
                                      'email': '[email protected]',
                                      'password1': 'secret',
                                      'password2': 'secret'})
        self.assertEqual(302, resp.status_code)

        new_user = UserModel().objects.get(username='bob')

        self.failUnless(new_user.check_password('secret'))
        self.assertEqual(new_user.email, '[email protected]')

        self.failIf(new_user.is_active)

        self.assertEqual(RegistrationProfile.objects.count(), 1)
        self.assertEqual(len(mail.outbox), 1)

        Site._meta.installed = True
开发者ID:hanks42,项目名称:django-registration,代码行数:29,代码来源:default_backend.py

示例2: test_registration

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration(self):
        """
        Registration creates a new inactive account and a new profile
        with activation key, populates the correct account data and
        sends an activation email.

        """
        resp = self.client.post(reverse('registration_register'),
                                data={'username': 'bob',
                                      'email': '[email protected]',
                                      'password1': 'secret',
                                      'password2': 'secret'})
        self.assertRedirects(resp, reverse('registration_complete'))

        new_user = UserModel().objects.get(username='bob')

        self.failUnless(new_user.check_password('secret'))
        self.assertEqual(new_user.email, '[email protected]')

        # New user must not be active.
        self.failIf(new_user.is_active)

        # A registration profile was created, and an activation email
        # was sent.
        self.assertEqual(RegistrationProfile.objects.count(), 1)
        self.assertEqual(len(mail.outbox), 1)
开发者ID:MUDASSARHASHMI,项目名称:django-registration,代码行数:28,代码来源:default_backend.py

示例3: test_registration

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration(self):
        """
        Registration creates a new inactive account and a new profile
        with activation key, populates the correct account data and
        sends an activation email.

        """
        resp = self.client.post(
            reverse("registration_register"),
            data={"username": "bob", "email": "[email protected]", "password1": "secret", "password2": "secret"},
        )
        self.assertRedirects(resp, reverse("registration_complete"))

        new_user = UserModel().objects.get(username="bob")

        self.failUnless(new_user.check_password("secret"))
        self.assertEqual(new_user.email, "[email protected]")

        # New user must not be active.
        self.failIf(new_user.is_active)

        # A registration profile was created, and an activation email
        # was sent.
        self.assertEqual(RegistrationProfile.objects.count(), 1)
        self.assertEqual(len(mail.outbox), 1)
开发者ID:Raouloq,项目名称:rmap,代码行数:27,代码来源:default_backend.py

示例4: test_profile_retrieval

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_profile_retrieval(self):
        # Testing User Information Retrieval for Login
        new_user = UserModel().objects.create_user(**self.user_info)
        existing_user = UserModel().objects.get(username='docemployee')

        self.failUnless(existing_user.check_password('letstravel'))
        self.assertEqual(existing_user.email, '[email protected]')
        self.failUnless(existing_user.is_active)
开发者ID:CommerceDataService,项目名称:ITA_Principal_Travel,代码行数:10,代码来源:test_travel.py

示例5: test_registration_no_sites

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration_no_sites(self):
        """
        Registration still functions properly when
        ``django.contrib.sites`` is not installed; the fallback will
        be a ``RequestSite`` instance.

        """
        resp = self.client.post(
            reverse("registration_register"),
            data={"username": "bob", "email": "[email protected]", "password1": "secret", "password2": "secret"},
        )
        self.assertEqual(302, resp.status_code)

        new_user = UserModel().objects.get(username="bob")

        self.failUnless(new_user.check_password("secret"))
        self.assertEqual(new_user.email, "[email protected]")

        self.failIf(new_user.is_active)

        self.assertEqual(RegistrationProfile.objects.count(), 1)
        self.assertEqual(len(mail.outbox), 1)
开发者ID:Raouloq,项目名称:rmap,代码行数:24,代码来源:default_backend.py

示例6: test_registration

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration(self):
        """
        Registration creates a new account and logs the user in.

        """
        resp = self.client.post(reverse('registration_register'),
                                data={'username': 'bob',
                                      'email': '[email protected]',
                                      'password1': 'secret',
                                      'password2': 'secret'})
        new_user = UserModel().objects.get(username='bob')
        self.assertEqual(302, resp.status_code)
        self.failUnless(reverse('registration_complete') in resp['Location'])

        self.failUnless(new_user.check_password('secret'))
        self.assertEqual(new_user.email, '[email protected]')

        # New user must be active.
        self.failUnless(new_user.is_active)

        # New user must be logged in.
        resp = self.client.get(reverse('registration_register'))
        self.failUnless(resp.context['user'].is_authenticated())
开发者ID:lucasdavila86,项目名称:django-registration,代码行数:25,代码来源:simple_backend.py

示例7: test_registration

# 需要导入模块: from registration.users import UserModel [as 别名]
# 或者: from registration.users.UserModel import check_password [as 别名]
    def test_registration(self):
        """
        Registration creates a new account and logs the user in.

        """
        resp = self.client.post(reverse('registration_register'),
                                data={'username': 'bob',
                                      'email': '[email protected]',
                                      'password1': 'secret',
                                      'password2': 'secret'})
        new_user = UserModel().objects.get(username='bob')
        self.assertEqual(302, resp.status_code)
        self.assertIn(getattr(settings, 'SIMPLE_BACKEND_REDIRECT_URL', '/'),
                      resp['Location'])

        self.assertTrue(new_user.check_password('secret'))
        self.assertEqual(new_user.email, '[email protected]')

        # New user must be active.
        self.assertTrue(new_user.is_active)

        # New user must be logged in.
        resp = self.client.get(reverse('registration_register'), follow=True)
        self.assertTrue(resp.context['user'].is_authenticated)
开发者ID:JostCrow,项目名称:django-registration,代码行数:26,代码来源:simple_backend.py


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