我想知道如何通過單擊具有用戶標識的電子郵件URL自動登錄用戶。CakePHP 3.x多種登錄方法
目前,登錄的唯一方法是在登錄屏幕中輸入用戶名和密碼。
基本上我只需要知道是否有方法讓我使用$ this-> Auth-> identify()和用戶標識,而不是用戶名和密碼。
下面是我用它來識別用戶的代碼:
if($this->request->is('post')){
$user = $this->Auth->identify();
if($user){
$this->Auth->setUser($user);
return $this->redirect(['controller' => 'dashboards']);
}else{
$this->Flash->error(__('Incorrect login!'));
$this->redirect(['controller' => 'Users', 'action' => 'login']);
}
}
要驗證用戶,只有用戶ID? –
我想通過常規登錄(用戶名,密碼)以及使用電子郵件中附加的鏈接(用戶ID)驗證用戶。 –