migrations run for lyric models; authentication & views & their tests now account more fully for uuid over email as pk
This commit is contained in:
@@ -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("/")
|
||||
|
||||
Reference in New Issue
Block a user