2012-08-30 2 views
0

CakePHPauthError URL을 사용자 정의하는 방법입니까? 나는 내가 AppController에 배치 한 Auth 구성 요소에 보면 내가 리디렉션 액션 loginRedirectlogoutRedirect을 가지고 있지만 그것이 가능 뭔가 authErrorRedirect 같이 설정하는 것입니다 모르겠어요 :CakePHP에서 authError 리디렉션 동작을 설정하는 방법은 무엇입니까?

<?php 
class AppController extends Controller { 

    public $components = array(
     'Session', 
     'Auth' => array(
      'loginRedirect' => array('controller' => 'users', 'action' => 'index'), 
      'logoutRedirect' => array('controller' => 'users', 'action' => 'index'), 
      'authError' => 'You don\'t have the right to go there.', 
      // something like this 
      'authErrorRedirect' => array('controller' => 'users', 'action' => 'login'), 
      'authorize' => array(
       'Controller', 
       'Actions' => array(
        'actionPath' => 'controllers' 
       ) 
      ), 
      'authenticate' => array(
       'Form' => array(
        'fields' => array('username' => 'email') 
       ) 
      ) 
     ), 
     'Acl' 
    ); 

할 수있는 내가 authError 설정 액션을 리디렉션합니까?

답변

0

아니요. 간단한 인증 및 권한 부여 응용 프로그램 예제 @CakePHP Cookbook v2.x documentation을 준수하는 경우 '잘못된 사용자 이름 또는 암호 ...'에 대한 로그인이 실패한 로그인 작업으로 리디렉션해야합니다. 다음 예에서 다른 작업으로 리디렉션하려는 경우에만 의미가 있습니다. login2

+0

사용자가 액세스 할 수없는 리소스로 이동하면 로그인하고 간단하고 명확하게해야합니다. – vitto

관련 문제