Re: login or login_decorator issue
what's your '@login_required(login_url='/login/')'?
seems like the decorator leads to the redirection.
-- 2012/8/8 mapapage <mapapage@gmail.com>
for the login I do (username must be the id field(pk) of an 'owners' table and password is a field of the same table):def login_user(request):c = {}c.update(csrf(request))state = ""if request.POST:password = request.POST.get('password')id = request.POST.get('id')try:user = Owners.objects.get(id = id)if user:if user.simple_check_password(password):url = reverse('main', kwargs={ 'user_id': user.id })return HttpResponseRedirect(url)else:state = 'Incorrect username or password'else:state = 'Incorrect username or password'except Exception as e:state = 'Incorrect username or password'print statereturn render_to_response('index.html', locals(), context_instance= RequestContext(request))
and I also define:def set_password(self, raw_password):self.password = make_password(raw_password)def check_password(self, raw_password):"""Returns a boolean of whether the raw_password was correct. Handleshashing formats behind the scenes."""def setter(raw_password):self.set_password(raw_password)self.save()return check_password(raw_password, self.password, setter=None)def simple_check_password(self,raw_password):return raw_password == self.passwordand at least it seems to me that it works, I mean the user logs in to the main.html page.To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/oPmX_2NBchQJ.--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home