LoginSignup
0
0

More than 5 years have passed since last update.

baserCMS3.xで「(type:csrf)CSRF対策によるエラーです」でログインできなくなった時の一時的対策

Posted at

不正なリクエストと判断されました。(type:csrf)CSRF対策によるエラーです。リクエストに含まれるCSRFトークンが不正または無効である可能性があります。
エラー: The request sent to the address '/admin/users/login' was invalid.

ローカル環境で baserCMS3系を触っていると、以下のエラーに遭遇してログインできなくなった時の一時的対策メモ

※注意
baserCMSのコアファイルの修正は自己責任でお願いします!
決して本番環境には反映しないように!

CSRFチェック機能をOFFにする

cakePHP2系のセキュリティのCSRFチェックを無効にします。

/lib/Baser/Controller/BcAppController.php

/lib/Baser/Controller/BcAppController.php
if(BC_INSTALLED && (!$this->plugin || in_array($this->plugin, $corePlugins))) {
    // $this->Security->csrfCheck = true;
    $this->Security->csrfCheck = false; // カスタマイズ CSRF対策を無効に
} else {

これでローカル環境でも無事ログインできるようになりました。

参考記事)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0