cake2.7.5でシステムを作っています。
ログイン認証についてつまってしまったので質問です。
usernameとpasswordで認証を行いたいのですが、登録されていないusernameとpasseord(適当に打ったもの)でもログインされてしまい、セキュリティ的にダメダメになっている状態です。
cakeのAuth認証のページhttp://book.cakephp.org/2.0/ja/tutorials-and-examples/blog-auth-example/auth.htmlを参考にしたのですがうまく機能しません。
問題点をご指摘いただけると幸いです。よろしくお願い致します。
以下LoginControllerのコード
<?php App::uses('BlowfishPasswordHasher', 'Controller\Component\Auth'); class LoginController extends AppController{ public function beforeFilter(){ parent::beforeFilter(); $this->Auth->allow('index'); } public function logout(){ $this->redirect($this->Auth->logout()); } public $uses=['User']; public function index(){ if($this->request->is('post')){ $data = $this->request->data; if ($this->Auth->login($data)) { $this->redirect($this->Auth->redirectUrl()); } } } /* public function init() { $hasher = new BlowfishPasswordHasher(); $this->User->save([ 'name' => 'テスト', 'login_id' => 'test', 'password' => $hasher->hash('test') ]); } */ }回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/03/25 07:54