hi
i have 2 django Project and i want importing users with passwords to another Project
when i do this, i have problem for login
imported users cant login
Note : i have custom user model
this 2 Project have same SECRET_KEY
and here is my login code
GetDomain = Domains.objects.filter(domain=get_domain(HTTP_HOST=request.META['HTTP_HOST'])).first()
Email = request.POST.get('mail', None)
raw_password = request.POST.get('pass', None)
recaptcha_response = request.POST.get('g-recaptcha-response', None)
if Email is None:
return HttpResponse(ajax_result(Code=200, message='ایمیل خالی است'))
if raw_password is None:
return HttpResponse(ajax_result(Code=200, message='پسورد خالی است'))
if recaptcha_response is None:
return HttpResponse(ajax_result(Code=200, message='کد امنیتی را وارد کنید'))
GetUser = User.objects.filter(email=Email).first()
if GetUser is not None and GetUser.is_active:
if GetUser.aff != GetDomain.UseBy.username:
return HttpResponse(ajax_result(Code=200, message='کاربر یافت نشد'))
if RecaptchaValidator(recaptcha_response):
if not GetUser.is_superuser and not GetUser.is_staff:
DeleteLastSessions(GetUser)
user = authenticate(username=GetUser.username, password=raw_password)
try:
login(request, user)
except AttributeError:
return HttpResponse(ajax_result(message='اطلاعات ورود اشتباه است'))
GetUser.Browser = request.META['HTTP_USER_AGENT']
GetUser.IsLogin = True
GetUser.LastLoginIP = GetIP(request)
GetUser.save()
if GetUser.is_superuser or GetUser.is_staff:
SubmitLog(user=request.user, Part='ورود به پنل', Number=None, Information=None,
IP=GetIP(request))
threading.Thread(target=WriteUserExtraInformation, args=(request, GetUser,), name='WI').start()
if GetUser.NeedVerify:
Context = '{"result" : "ok", "data": {"url":"/tickets/send?verify=1"}}'
else:
if 'next' in request.GET.keys():
Context = '{"result" : "ok", "data": {"url":"' + request.GET['next'] + '"}}'
else:
Context = '{"result" : "ok", "data": {"url":"/profile/"}}'
response = HttpResponse(Context)
response.set_cookie('app', 'True', secure=True)
return response
else:
return HttpResponse(ajax_result(message='کد امنیتی درست وارد نشده'))
else:
return HttpResponse(ajax_result(message='اطلاعات ورود اشتباه است'))
what should i do ?