matthiask / django-authlib

Utilities for passwordless authentication (using magic links, Google, Facebook and Twitter OAuth currently)
https://django-authlib.readthedocs.io/
MIT License
61 stars 11 forks source link

Login - logout templates missing? #8

Closed raratiru closed 2 years ago

raratiru commented 2 years ago

I receive this error:

django.template.exceptions.TemplateDoesNotExist: registration/login.html

from the following line:

https://github.com/matthiask/django-authlib/blob/0c49aa7e9ef889f0c7862d5039bd1b12e780b3f9/authlib/views.py#L82

Are the templates missing?

matthiask commented 2 years ago

Yes; django-authlib doesn't ship any templates. This is somewhat intentional; django.contrib.auth also references registration/login.html and doesn't ship such a template.

I'm not fundamentally opposed to shipping a set of templates but it should probably happen in a separate app, or for example in a new authlib.packages.registration_templates app (or something) to prevent the problem where django-authlib's templates would suddenly start overriding e.g. the templates used by django.contrib.admin by default (resp. depending on the ordering of INSTALLED_APPS)

matthiask commented 2 years ago

By the way, https://docs.djangoproject.com/en/4.0/topics/auth/default/#django.contrib.auth.views.LoginView says:

It’s your responsibility to provide the html for the login template , called registration/login.html by default. This template gets passed four template context variables:

raratiru commented 2 years ago

Oh, OK, indeed!

I had the impression that magic links would need a special template to work.

Actually, I have not yet grasped the idea of the procedure, but I will dive into the code, it is not so hard, thank you!

raratiru commented 2 years ago

It is unbelievable how many things this code achieves with just a few lines.

Thank you for sharing!

Browsing it, is amazing and inspiring.

matthiask commented 2 years ago

Wow, thank you! That's a really nice compliment ❤