reenabled admin area; outfitted apps.lyric.models w. AbstractBaseUser instead of custom user class; many other fns & several models updated to accomodate, such as set_unusable_password() method to base user model; reset staging db to prepare for refreshed lyric migrations to accomodate for retrofitted pw field
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
from django.conf import settings
|
||||
from django.contrib.auth import BACKEND_SESSION_KEY, SESSION_KEY, get_user_model
|
||||
from django.contrib.auth import (
|
||||
BACKEND_SESSION_KEY,
|
||||
HASH_SESSION_KEY,
|
||||
SESSION_KEY,
|
||||
get_user_model,
|
||||
)
|
||||
from django.contrib.sessions.backends.db import SessionStore
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
@@ -18,6 +23,7 @@ def create_pre_authenticated_session(email):
|
||||
user = User.objects.create(email=email)
|
||||
session = SessionStore()
|
||||
session[SESSION_KEY] = str(user.pk) # Convert UUID to string for JSON serialization
|
||||
session[BACKEND_SESSION_KEY] = settings.AUTHENTICATION_BACKENDS[0]
|
||||
session[BACKEND_SESSION_KEY] = "apps.lyric.authentication.PasswordlessAuthenticationBackend"
|
||||
session[HASH_SESSION_KEY] = user.get_session_auth_hash()
|
||||
session.save()
|
||||
return session.session_key
|
||||
|
||||
Reference in New Issue
Block a user