Ejemplo n.º 1
0
    def getHash(self, referer="/"):
        c = Client()
        kw = [None]

        def handler(sender, **kwargs):
            kw[0] = kwargs

        hash_was_generated.connect(handler)

        r = c.post(self.send_login_url, data=dict(email="*****@*****.**"), HTTP_REFERER=referer)
        return kw[0]["hash"]
Ejemplo n.º 2
0
    def testPostEmailGeneratesSignal(self):
        c = Client()
        kw = [None]

        def handler(sender, **kwargs):
            kw[0] = kwargs

        hash_was_generated.connect(handler)

        r = c.post(self.send_login_url, data=dict(email="*****@*****.**"))

        self.assert_(kw[0] is not None)
        self.assert_("hash" in kw[0])
        self.assertEqual("*****@*****.**", kw[0]["email"])
Ejemplo n.º 3
0
    def testPostEmailGeneratesSignal(self):
        c = Client()
        kw = [None]

        def handler(sender, **kwargs):
            kw[0] = kwargs

        hash_was_generated.connect(handler)

        r = c.post(self.send_login_url,
                   data=dict(email='*****@*****.**'))

        self.assert_(kw[0] is not None)
        self.assert_('hash' in kw[0])
        self.assertEqual('*****@*****.**', kw[0]['email'])
Ejemplo n.º 4
0
    def getHash(self, referer='/'):
        c = Client()
        kw = [None]

        def handler(sender, **kwargs):
            kw[0] = kwargs

        hash_was_generated.connect(handler)

        r = c.post(
            self.send_login_url,
            data=dict(email='*****@*****.**'),
            HTTP_REFERER=referer,
        )
        return kw[0]['hash']
Ejemplo n.º 5
0
from django.conf.urls.defaults import *
from django_link_auth.signals import hash_was_generated
from django_link_auth.utils import send_link_by_email


urlpatterns = patterns('django_link_auth.views',
     (r'^send-login-link/$', 'send_login_link', {}, 'link-auth-send'),
     (r'^login/$', 'login', {}, 'link-auth-login'),
)

hash_was_generated.connect(send_link_by_email)