Files
octopus/myproject/accounts/urls.py
Andrey Smakotin fb4bcf37ec feat: implement password setup link for tenant registration
When admin approves tenant registration:
- Owner account created in tenant schema (in addition to admin@localhost)
- Owner assigned 'owner' role with full permissions
- Password setup email sent with secure 7-day token link
- Owner sets password via link and auto-logs into their shop

Key changes:
- Added password_setup_token fields to TenantRegistration model
- Created tenants/services.py with formatted email service
- Modified _approve_registration to create owner account
- Added password_setup_confirm view with token validation
- Created password setup template and URL route
- Added admin action to resend password setup emails

Security:
- Token expires after 7 days
- Password not transmitted in email (secure setup link)
- Owner account inactive until password set
- Admin@localhost preserved for system administrator access

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-01 22:08:18 +03:00

16 lines
764 B
Python

from django.urls import path
from . import views
app_name = 'accounts'
urlpatterns = [
path('register/', views.register_view, name='register'),
path('login/', views.login_view, name='login'),
path('logout/', views.logout_view, name='logout'),
path('profile/', views.profile_view, name='profile'),
path('profile/change-password/', views.change_password_view, name='change_password'),
path('confirm/<uuid:token>/', views.confirm_email, name='confirm_email'),
path('password-reset/', views.password_reset_request, name='password_reset'),
path('password-reset/<uuid:token>/', views.password_reset_confirm, name='password_reset_confirm'),
path('setup-password/<uuid:token>/', views.password_setup_confirm, name='password_setup'),
]