migrations run for lyric models; authentication & views & their tests now account more fully for uuid over email as pk

This commit is contained in:
Disco DeDisco
2026-01-30 21:33:30 -05:00
parent f002cc5c84
commit ae63861adb
6 changed files with 60 additions and 10 deletions

View File

@@ -1,8 +1,9 @@
from django.contrib import messages
from django.contrib import auth, messages
from django.core.exceptions import ValidationError
from django.core.mail import send_mail
from django.shortcuts import redirect
from django.urls import reverse
from .models import Token
from .models import Token, User
from ..dashboard.forms import ItemForm
def send_login_email(request):
@@ -25,4 +26,13 @@ def send_login_email(request):
return redirect("/")
def login(request):
uid = request.GET.get("token")
if not uid:
return redirect("/")
user = auth.authenticate(request, uid=uid)
if user is not None:
user.backend = "apps.lyric.authentication.PasswordlessAuthenticationBackend"
auth.login(request, user)
return redirect("/")