teratail header banner
teratail header banner
質問するログイン新規登録

回答編集履歴

5

バージョン不適合であったため、修正。

2020/05/15 23:31

投稿

Yasumichi
Yasumichi

スコア1773

answer CHANGED
@@ -1,6 +1,6 @@
1
1
  今一度、以下の記事を読まれてはいかがでしょうか?
2
2
 
3
- [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
3
+ [シンプルな認証と認可のアプリケーション - 4.x](https://book.cakephp.org/4/ja/tutorials-and-examples/blog-auth-example/auth.html)
4
4
 
5
5
  未検証ですが、上記のページと同様に `'action' =>'logout',` の後に `'home'`などを加えると良いのではないでしょうか?(ログインページに当たるものを書く。)
6
6
 

4

(ログインページに当たるものを書く。)

2020/05/15 23:31

投稿

Yasumichi
Yasumichi

スコア1773

answer CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
4
4
 
5
- 未検証ですが、上記のページと同様に `'action' =>'logout',` の後に `'home'`などを加えると良いのではないでしょうか?
5
+ 未検証ですが、上記のページと同様に `'action' =>'logout',` の後に `'home'`などを加えると良いのではないでしょうか?(ログインページに当たるものを書く。)
6
6
 
7
7
  ```php
8
8
  'logoutRedirect' => [

3

修正の一案を提示

2020/05/15 17:21

投稿

Yasumichi
Yasumichi

スコア1773

answer CHANGED
@@ -1,3 +1,13 @@
1
1
  今一度、以下の記事を読まれてはいかがでしょうか?
2
2
 
3
- [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
3
+ [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
4
+
5
+ 未検証ですが、上記のページと同様に `'action' =>'logout',` の後に `'home'`などを加えると良いのではないでしょうか?
6
+
7
+ ```php
8
+ 'logoutRedirect' => [
9
+ 'controller' =>'User',
10
+ 'action' =>'logout',
11
+ 'home'
12
+ ],
13
+ ```

2

実装同じだったので修正

2020/05/15 17:17

投稿

Yasumichi
Yasumichi

スコア1773

answer CHANGED
@@ -1,12 +1,3 @@
1
1
  今一度、以下の記事を読まれてはいかがでしょうか?
2
2
 
3
- [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
3
+ [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
4
-
5
- 上記の記事だと以下のように実装されてますね。
6
-
7
- ```php
8
- public function logout()
9
- {
10
- return $this->redirect($this->Auth->logout());
11
- }
12
- ```

1

コード例を転記

2020/05/15 17:10

投稿

Yasumichi
Yasumichi

スコア1773

answer CHANGED
@@ -1,6 +1,12 @@
1
- 一度、こちらの記事を読まれてはいかがでしょうか?
1
+ 一度、以下の記事を読まれてはいかがでしょうか?
2
2
 
3
3
  [シンプルな認証と認可のアプリケーション - 3.8](https://book.cakephp.org/3/ja/tutorials-and-examples/blog-auth-example/auth.html)
4
4
 
5
+ 上記の記事だと以下のように実装されてますね。
5
6
 
7
+ ```php
8
+ public function logout()
9
+ {
6
- > CakePHP において、これは Cake\Controller\Component\AuthComponent で扱われており、 このクラスはあるアクションのログインで必要となり、ユーザーのログインとログアウトを扱い、 そしてログインユーザーがアクセスできるアクションの認証を行います。
10
+ return $this->redirect($this->Auth->logout());
11
+ }
12
+ ```