2011-09-14 48 views
0

我從鏈接下載插件 https://github.com/CakeDC/usersCakePHP的用戶管理插件實現

緊跟在頁面給出的步驟。我創建了表'用戶'和'細節'。我也註冊了用戶並且對用戶進行了認證,但是當訪問鏈接www.mydomain/users/users/login時,這個頁面被重定向到www.mydomain/users/login ,這顯示了缺少控制器。我對蛋糕很陌生,對我來說很難調試。如果有人幫助我,我會感謝。


謝謝你的迴應。

是的,我已經添加了「cake \ libs \ controller \ app_controller.php」文件中給出的代碼。爲了測試這個,我剛剛下載了核心文件並在本地系統中設置了這些文件。我已經將插件的'utils','search'和'users'放入我的app/plugins文件夾並創建了表格。

現在我也可以註冊用戶,但無法看到登錄頁面。即。 「訪問鏈接www.mydomain /用戶/用戶/登錄此頁面正在重定向到www.mydomain/users /登錄顯示缺少控制器」。

如果我缺少任何東西或者我錯了,請讓我知道。

謝謝。

回答

3

這看起來像登錄重定向中的問題。

您是否將beforeFilter()配置添加到您的app_controller?

如果不是,您可能需要添加它。

這裏是你的app_controller應該怎麼看起來像一個例子:

<?php 
    class AppController extends Controller { 
     var $components = array('RequestHandler', 'Session', 'Auth'); 

     function beforeFilter(){ 
      $this->Auth->fields = array('username' => 'email', 'password' => 'passwd'); 
      $this->Auth->loginAction = array('plugin' => 'users', 'controller' => 'users', 'action' => 'login', 'admin' => false); 
      $this->Auth->loginRedirect = '/'; 
      $this->Auth->logoutRedirect = '/'; 
      $this->Auth->authError = __('Sorry, but you need to login to access this location.', true); 
      $this->Auth->loginError = __('Invalid e-mail/password combination. Please try again', true); 
      $this->Auth->autoRedirect = false; 
      $this->Auth->userModel = 'Users.User'; 
      $this->Auth->userScope = array('User.active' => 1); 
     } 
    } 

?> 

記住這 - $> Auth->在loginAction大多含有的「插件」 =>「用戶」,沒有它,它會去www.mydomain /用戶/登錄,而不是www.mydomain /用戶/用戶/登錄

+0

我試圖編輯您的帖子和更正beforFilter() - >應該beforeFilter(),但StackOverflow認爲我的編輯應該有最少6個字符(?)。 – bazzaretta

+1

@bazzaretta thnx,我爲你編輯:) – api55