简体   繁体   English

Drupal 9.2 注销后无法登录

[英]Drupal 9.2 Login not working after logout

My site upgraded from Drupal 8.x to Drupal 9.2.4 (PHP 7.4).我的网站从 Drupal 8.x 升级到 Drupal 9.2.4 (PHP 7.4)。 Once logout then login was not working.一旦注销然后登录不起作用。 No error or warning, just page refresh happened.没有错误或警告,只是发生了页面刷新。 I checked the cookie compared with my old version, one of the cookies was not set after first login and logout.我检查了与旧版本相比的 cookie,其中一个 cookie 在第一次登录和注销后没有设置。

The below image session is not set for second-time login.下图会话未设置为第二次登录。

Missing session image缺少会话图像

在此处输入图片说明

I am not sure this is the problem, maybe.我不确定这是问题所在,也许吧。

I had the same issue.我遇到过同样的问题。 I am using my own redirect in hook_user_login().我在 hook_user_login() 中使用我自己的重定向。 After update from Drupal 9.1 to Drupal 9.2 my redirect stoped working (no login and no redirect).从 Drupal 9.1 更新到 Drupal 9.2 后,我的重定向停止工作(没有登录也没有重定向)。 I found information on Drupal forum that 'redirect after login is breaking a basic contract of Drupal hooks, in that it is halting execution.'我在 Drupal 论坛上发现“登录后重定向违反了 Drupal 钩子的基本合同,因为它正在停止执行”的信息。 On the same forum I found suggestion to save session before sending a response, so I tried this on my code:在同一个论坛上,我发现在发送回复之前保存会话的建议,所以我在我的代码上尝试了这个:

$response = new RedirectResponse($url->toString());
$request = \Drupal::request();

// Save the session so things like messages get saved.
$request->getSession()->save();

$response->prepare($request);
$response->send();

Source: https://www.drupal.org/project/redirect_after_login/issues/3214949#comment-14138959来源: https : //www.drupal.org/project/redirect_after_login/issues/3214949#comment-14138959

升级到 9.2 后我遇到了同样的问题......会话已打开,但无法登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM