Authコンポーネントの使い方

cakephp初心者です。

cakephp 1.3.7.0です。

Authコンポーネントの基本的な使い方を教えてください。

作りたいのは以下のような遷移です。

users/loginでログインする

→IDとパスが合っていたらtask/tasksにリダイレクトする

→IDとパスが合っていなかったらusers/loginに戻る

ところが、

・IDとパスを入力してもtask/tasksにリダイレクトされない(認証できなかったというエラーメッセージは出ていない)

・その後、task/tasksをアドレスバーに入力してアクセスすると、「You are not authorized to access that location.」とエラーが出る(認証がされていない)

となってしまいます。

ソースコードは以下の通りです。

<users_controller.php>

class UsersController extends AppController{

public $name = 'Users';

public $components = array('Auth');

function login(){

$this->Auth->loginRedirect = 'tasks';

}

function logout(){

$this->Auth->logout();

}

}

<tasks_controller.php>

class TasksController extends AppController {

public $name = 'Tasks';

public $uses = array('Contents', 'Status','Users');

public $components = array('Auth');

function index(){

}

}

以上です。

何卒ご教授のほど宜しくお願い致します。

質問者:pnphp, on 23/3/11

1 Answer

Sorry, but there are no answers yet.

Your Answer

You can use Creole Wiki Syntax to format your text.

Rating

0

Viewed

2001 times

Last Activity

on 27/9/11