There is the same problem with me for many days~~ "Username: Your Web browser doesn't appear to have cookies enabled. Cookies are required for logging in. "
Help~~thx may be clear the session table will solve the problem~~ 2007/9/20, Ana <[EMAIL PROTECTED]>: > > > Hi, > I have problem with sessions and loggin function in my application. > When user wants to login but enter wrong username or password and > click "ok" the wrong password error occurs and that's correct. But > when the user wants to correct a mistake and click "ok" en error: > "Error: no_cookies = True." occurs. The user has to reload the page > and type password and username again. > Cookies in my browser are enabled. > Is there any way to deal with this problem? I'll be grateful for any > suggestions. > > I use DualSessionMiddleware and my log function is: > > def login(request): > """login user with authenication - logout previous user first, > template: login > """ > no_cookies = False > account_disabled = False > invalid_login = False > redirect_to = request.REQUEST.get(REDIRECT_FIELD_NAME, '') > if request.method == 'POST': > if request.session.test_cookie_worked(): > request.session.delete_test_cookie() > form = LoginForm(request.POST) > if form.is_valid(): > username = request.POST['username'] > password = request.POST['password'] > user = auth.authenticate(username=username, > password=password) > if user is not None: > if user.is_active: > # Correct password, and the user is marked > "active" > auth.login(request, user) > > request.session[settings.PERSISTENT_SESSION_KEY] = > form.clean_data['remember_user'] > return HttpResponseRedirect("/ > ResourceScheduler/" ) > else: > account_disabled = True > else: > invalid_login = True > else: > no_cookies = True > > form = None > return HttpResponse("Error: no_cookies = True.") > else: > form = LoginForm() > # cookie must be successfully set/retrieved for the form to be > processed > request.session.set_test_cookie() > return render_to_response("ResourceScheduler/login.html", > {'no_cookies': no_cookies, 'form': form,'account_disabled': > account_disabled,'invalid_login': invalid_login, > REDIRECT_FIELD_NAME: redirect_to}, context_instance = > RequestContext(request)) > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---