Log out show error message "... your browser must accept cookies ..."

Created on 22 December 2021, about 3 years ago
Updated 25 May 2023, over 1 year ago

Problem/Motivation

Drupal 9.3.0. After logged out I get message and url have attached /?check_logged_in=1

Here patch with helped me

Steps to reproduce

- Install a new site from scratch from 9.3.x upwards.
- After all is done, logout the new admin user that was created during the setup,
- The notice in the screenshot appears.

Logging in and out with the admin user doesn't make the notice appear again, nor does creating a new user and logging in and out with that.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

๐Ÿ› Bug report
Status

Needs work

Version

9.5

Component
User moduleย  โ†’

Last updated 2 days ago

Created by

๐Ÿ‡บ๐Ÿ‡ฆUkraine cosolom

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡จ๐Ÿ‡ดColombia jedihe

    Patch #4 works on Drupal 9.5.8. We were having a problem where hitting /user/logout triggers the "To log in to this site..." message, after the user is properly logged out. A closer look into Drupal core showed that Drupal/Core/Session/SessionManager::destroy() calls session_destroy() instead of Session::invalidate() due to unwanted side-effects (details there); due to this, I also checked and found that both the session record and the browser-session-cookie are correctly cleared, which means the patch doesn't cause redundant session rows or bad impacts on caching.

    I also ran some testing in a simplytest.me instance (vanilla 9.5.10-dev) and found:

    • Chrome set to block cookies gets to show the "To log in to this site..." error message after submitting /user/login with valid login credentials.
    • Chrome with cookies allowed: on logout, everything is properly cleared: browser-cookie as well as session record (checked this using views_sessions module).

    Given all of the above, I think #4 is in great shape. Hopefully we can get some tests written, so it can be reviewed for merging.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium BramDriesen Belgium ๐Ÿ‡ง๐Ÿ‡ช

    Since Drupal 9 will be EOL soon, I think this needs to target D11 and get a backport to D10

  • ๐Ÿ‡ท๐Ÿ‡บRussia batkor Irkutsk

    Thanks, PAtch #4 worked for me.
    Drupal 10.1.1)

  • First commit to issue fork.
  • Merge request !5634Resolve #3255711 "Log out show" โ†’ (Open) created by djsagar
  • Status changed to Needs review about 1 year ago
  • Merge request !563511.x โ†’ (Open) created by djsagar
  • Pipeline finished with Failed
    about 1 year ago
    Total: 182s
    #57729
  • Status changed to Needs work about 1 year ago
  • The Needs Review Queue Bot โ†’ tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request โ†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • Merge request !5663Djsagar 293afe7d patch 2e47 โ†’ (Open) created by djsagar
  • Status changed to Needs review about 1 year ago
  • Pipeline finished with Failed
    about 1 year ago
    Total: 170s
    #58600
  • Status changed to Needs work about 1 year ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Previously tagged for tests. When changing to review please take a look at the issue summary and tags to make sure itโ€™s ready.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    andrew.farquharson โ†’ made their first commit to this issueโ€™s fork.

  • Pipeline finished with Failed
    11 months ago
    Total: 160s
    #135737
  • Pipeline finished with Failed
    11 months ago
    Total: 160s
    #135788
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    Merge request !5634 has patch #4 applied.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    The proposed fix at #18 seems the best solution. It fixes the original issue as strictly described. I have tested site instalaltion using drush site:install (Drupal 11.x) command. The bug does not occur. I believe that fix #18 since it targets the file that controls site installation done via the Drupal UI. Fix at #4 is far more general in its action and could have side-effects.

    @smustgrave I am not sure how to test the installation via the Drupal UI? Is it possible to create a test that tests the equivalent of a Drupal UI installation? If a test is not feasible, it is simple to re-create the issue using the summary and testing manually.

    There is a more general issue, possibly, as described at #22. But that should be dealt with as a new issue.

  • Pipeline finished with Canceled
    11 months ago
    Total: 813s
    #142030
  • Pipeline finished with Canceled
    11 months ago
    Total: 142s
    #142048
  • Pipeline finished with Failed
    11 months ago
    Total: 992s
    #142049
  • Pipeline finished with Success
    11 months ago
    #142075
  • Status changed to Needs review 11 months ago
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    I have applied the one liner fix at #18. I have not added any test because I do not know how a fresh installation using the UI is possible in, say, a kernel test. Unless someone knows how to create such a test, please review and test the fix manually.

    To see how the issue is isolated to installations via the UI, try a site install using drush and note that the issue does not arise.

  • Status changed to Needs work 11 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States smustgrave

    Still putting in NW as tests will be needed.

    But does anyone have a suggestion for #41

    Know can do a fresh install using functional tests.

  • Pipeline finished with Failed
    11 months ago
    Total: 1079s
    #144205
  • Pipeline finished with Failed
    10 months ago
    Total: 1083s
    #152169
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States jcandan

    @andrewfarq,

    Not sure what happened with [!5634], but it looks to have ended up only adding testSessionManagerInvalidateSessionOnDestroy(), and no other changes.

    Also, your proposal in #40 ๐Ÿ› Log out show error message "... your browser must accept cookies ..." Needs work may ignore other's experiences with this issue outside of the install process , such as after upgrade #21 ๐Ÿ› Log out show error message "... your browser must accept cookies ..." Needs work or with anonymous users #22 ๐Ÿ› Log out show error message "... your browser must accept cookies ..." Needs work . Or is that what #18 ๐Ÿ› Log out show error message "... your browser must accept cookies ..." Needs work is proposing? I may have misunderstood that.

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    @jcandan I have applied a one-liner fix. the fix

    This is the fix suggested at #18

    Also, your proposal in #40 may ignore other's experiences with this issue...

    The issue description contains steps to reproduce: "Install a new site via the Drupal UI". So if others are experiencing related issues it might be best if those users create child issues so they can be fixed outside this issue.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    Seems there are related or may be similar: https://www.drupal.org/project/drupal/issues/3397718 ๐Ÿ› "To log in to this site, your browser must accept cookies from the domain" error message displayed when user goes back and reload the page Needs work

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    I have edited this issue after carrying out further manual testing on Drupal 11.

    @prashant.c Thank you for #46. I have read it with interest. I was unable to reproduce issue 3397718 on Drupal 11. So, it may be isolated to Drupal 9.5.

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia prashant.c Dharamshala

    @andrew.farquharson I tried it on branch 11.x but could not reproduce. Will try on the Drupal 10 and on https://www.drupal.org/project/drupal/releases/11.0.1

  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London
  • ๐Ÿ‡ฌ๐Ÿ‡งUnited Kingdom oily Greater London

    @prashant.c I have been testing on the Drupal 11.0.1.

  • Pipeline finished with Failed
    6 months ago
    Total: 591s
    #272681
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia manojkumar_g

    I'm facing the same issue in the Drupal 10.3.0 version. Are any patches or fixes available for that?

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance kumkum29

    Hi !,

    Have you found a simple solution for Drupal 10.2 / 10.3.... ?

    Thanks for your replies.

Production build 0.71.5 2024