python - Django logging in as anonymous user? -


i trying login user . after creating profile . when authorises him logs in anonymous user.

from django.contrib.auth import authenticate authorise  def shopify_register(request):      print "############*****got details*****############"     password = request.post['pass']       subs, stat = subscription.objects.get_or_create(validity=datetime.now()+timedelta(days=30))     newuser, stat = user.objects.get_or_create(username=request.post['email'])     newuser.set_password(password)     newuser.save()     user, stat = userprofile.objects.get_or_create(subscription=subs,user=newuser)     domain, stat = domain.objects.get_or_create(user_profile=user, shortname=request.post['shop_name'], keywords=request.post['keywords'])      profile,stat = shopifyuserprofile.objects.get_or_create(shop_user =user.. etc )     username = request.post['email']        authuser = authorise(username=username, password=mdpass)     domain = domain.objects.get(user_profile=user)     testimonies = testimony.objects.filter(domain=domain).filter(show=0).order_by('-timestamp')     c = requestcontext(request, {         'user' : user,         'testimonies': testimonies,         'request': request,         'mentions': 1,         'domain': domain     })     return render_to_response('homepage.html', context_instance=c) 

update :

authuser = authorise(username=username, password=mdpass) 

this not authorises user . though user has been created .

it works fine logs user anonymous user ? wrong here ?

removed md5 hashing still user not being authorised.

update :2

ipdb> authuser = authorise(username=username, password=password) ipdb> authuser <user: ratan@kumar.com> ipdb> temp=auth_login(request,authuser) ipdb> temp ipdb> print temp none 

it means has authorised user has not able log him in.

you need call login function after authenticate.

from django.contrib.auth import login auth_login auth_login(request, user) 

Comments

Popular posts from this blog

Change php variable from jquery value using ajax (same page) -

Pull out data related to my apps from Android Play Store and iOS App Store -

How can I fetch data from a web server in an android application? -