Results 1 to 6 of 6

Thread: CSRF token missing or incorrect

  1. #1
    Newbie
    Join Date
    Aug 2011
    Posts
    2

    Exclamation CSRF token missing or incorrect

    I always meet the problem when do ops. It happened occasionally and can be fixed by refreshing the page, but it's really annoying, especially when the network is slow.

    Here's the whole error msg
    ======================================================
    Forbidden (403)
    CSRF verification failed. Request aborted.

    Help
    Reason given for failure:

    CSRF token missing or incorrect.
    In general, this can occur when there is a genuine Cross Site Request Forgery, or when Django's CSRF mechanism has not been used correctly. For POST forms, you need to ensure:

    ?The view function uses RequestContext for the template, instead of Context.
    ?In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL.
    ?If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data.
    You're seeing the help section of this page because you have DEBUG = True in your Django settings file. Change that to False, and only the initial error message will be displayed.

    You can customize this page using the CSRF_FAILURE_VIEW setting.

    ==============================================

    Aslo I've google it and find a possible solution

    You need to add 'django.middleware.csrf.CsrfResponseMiddleware' in your setting.py file, it looks like that:


    MIDDLEWARE_CLASSES = (

    'django.middleware.common.CommonMiddleware',

    'django.contrib.sessions.middleware.SessionMiddleware',

    'django.middleware.csrf.CsrfViewMiddleware',

    'django.contrib.auth.middleware.AuthenticationMiddleware',

    'django.contrib.messages.middleware.MessageMiddleware',

    'django.middleware.csrf.CsrfResponseMiddleware',

    )

  2. #2
    Game Support Bishop's Avatar
    Join Date
    Jul 2008
    Posts
    21,332
    do you have multiple tabs open?
    Support email: utopiasupport@utopia-game.com <- please use this and don't just PM me| Account Deleted/Inactive | Utopia Facebook Page | #tactics <-- click to join IRC|
    PM DavidC for test server access

  3. #3
    Newbie
    Join Date
    Aug 2011
    Posts
    2
    yes. I think so. Does that mean we can't open utopia in multiple tabs?

  4. #4
    I like to post Landro's Avatar
    Join Date
    Feb 2010
    Location
    Netherlands
    Posts
    3,616
    I often have 8+ Utopia tabs open in FF and never had this problem.
    This is my province. There are many like it, but this one is mine.
    My province is my best friend. It is my life. I must master it as I must master my life.
    My province, without me, is useless. Without my province, I am useless.
    I must attack hard with my province. I must attack harder than my enemy who is trying to pk me. I must pk him before he pk's me. I will...

  5. #5
    Regular
    Join Date
    May 2011
    Posts
    72
    Same here, using Mozilla and when I'm not in war I always have multiple tabs open without problems.

  6. #6
    Game Support Bishop's Avatar
    Join Date
    Jul 2008
    Posts
    21,332
    Multiple tabs can sometimes (not always obviously) cause funny issues with security features as they basically mimic bad behaviour. I'm not saying you cant open 20 tabs if you want, but it if you get that issue with tabs open then that is most likely the cause.

    http://en.wikipedia.org/wiki/Cross-site_request_forgery
    Support email: utopiasupport@utopia-game.com <- please use this and don't just PM me| Account Deleted/Inactive | Utopia Facebook Page | #tactics <-- click to join IRC|
    PM DavidC for test server access

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •