Open erikvlm opened 4 years ago
I know this question is long-standing already. The issue is that the session attached to the request
object passed to the django login
function does not exist on the tenant schema which you are executing the login in its context.
You might want to consider logging in with a token that you sort of pass into the URL. I think there's a library that does something similar which is [https://github.com/aaugustin/django-sesame] or you could implement it yourself. Should not be too hard. Let me know if you get the concept.
Hola, yo lo hice de esta manera, espero te ayude.
subdomain = form.cleaned_data["subdomain"]
host = request.META.get('HTTP_HOST', '')
scheme_url = request.is_secure() and "https" or "http"
url = f"{scheme_url}://{subdomain}.{host}"
return HttpResponseRedirect(url)
Yes of course, this only redirects to the subdomain and the user has to enter their credentials. It is for security reasons, but it could be redirected directly to the subdomain with the user already logged in.
[image: Naranja Apps S.A.C.]
Juan Chávez Reátegui Gerente General | Naranja Apps S.A.C. mobile: (+51) 949-236969 <(+51)+949-236969> site: www.naranja.pe email: @.***
El mar, 22 mar 2022 a las 17:35, Joseph Jeong @.***>) escribió:
Hola, yo lo hice de esta manera, espero te ayude. subdomain = form.cleaned_data["subdomain"] host = request.META.get('HTTP_HOST', '') scheme_url = request.is_secure() and "https" or "http" url = f"{scheme_url}://{subdomain}.{host}" return HttpResponseRedirect(url)
seems like this doesn't really logs in the user
— Reply to this email directly, view it on GitHub https://github.com/bernardopires/django-tenant-schemas/issues/615#issuecomment-1075717931, or unsubscribe https://github.com/notifications/unsubscribe-auth/APJE6EH7DFEHYDOAA6WUONLVBJDJRANCNFSM4J6RLK2A . You are receiving this because you commented.Message ID: @.***>
Yo lo hice de otra manera y me funciona bien, existen otras formas de usar los usuarios en los tenants, depende mucho de lo que deseas hacer en tu web,
[image: Naranja Apps S.A.C.]
Juan Chávez Reátegui Gerente General | Naranja Apps S.A.C. mobile: (+51) 949-236969 <(+51)+949-236969> site: www.naranja.pe email: @.***
El mar, 22 mar 2022 a las 17:29, Joseph Jeong @.***>) escribió:
any updates on this? I have a similar issue and tried using the django login() function but got the same error... is there anyway to do this without having a centralized user table for all tenants?
— Reply to this email directly, view it on GitHub https://github.com/bernardopires/django-tenant-schemas/issues/615#issuecomment-1075710470, or unsubscribe https://github.com/notifications/unsubscribe-auth/APJE6EHII5N3HTRDOBSRDYDVBJCTHANCNFSM4J6RLK2A . You are receiving this because you commented.Message ID: @.***>
If a user goes to
maindomain.com
and registers, I can successfully create a schema for them and redirect them to tenant.maindomain.com. The issue is that I can't seem to find a way to log the user in. (The user does exist in the correct schema). I'm getting this error:when trying to log them in right away after creating a tenant + logging them in.
Below is the user registration logic I'm using
Any ideas?