fix: add missing imports and routes for password setup flow
- Added get_user_model import in accounts/views.py - Fixed User variable scope in password_setup_confirm view - Added accounts URLs to urls_public.py for password setup on main domain - Password setup link now accessible from public schema Technical details: - get_user_model() needed to be imported from django.contrib.auth - User model reference moved outside try block to fix UnboundLocalError - accounts.urls included in public URLconf for /accounts/setup-password/ route 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.contrib.auth import login, authenticate, logout
|
from django.contrib.auth import login, authenticate, logout, get_user_model
|
||||||
from django.contrib import messages
|
from django.contrib import messages
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
@@ -239,8 +239,8 @@ def password_setup_confirm(request, token):
|
|||||||
|
|
||||||
# Переключиться на схему тенанта чтобы найти владельца
|
# Переключиться на схему тенанта чтобы найти владельца
|
||||||
connection.set_tenant(tenant)
|
connection.set_tenant(tenant)
|
||||||
|
User = get_user_model()
|
||||||
try:
|
try:
|
||||||
User = get_user_model()
|
|
||||||
owner = User.objects.get(email=registration.owner_email)
|
owner = User.objects.get(email=registration.owner_email)
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
connection.set_schema_to_public()
|
connection.set_schema_to_public()
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ from django.conf.urls.static import static
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('', include('tenants.urls')), # Роуты для регистрации тенантов (/, /register/, /register/success/)
|
path('', include('tenants.urls')), # Роуты для регистрации тенантов (/, /register/, /register/success/)
|
||||||
|
path('accounts/', include('accounts.urls')), # Роуты для установки пароля владельцами тенантов
|
||||||
]
|
]
|
||||||
|
|
||||||
# Serve media files in development
|
# Serve media files in development
|
||||||
|
|||||||
Reference in New Issue
Block a user