ログイン画面の実装について

2019年10月3日 at 20:24

Login Block を使ってログインフォームを独自に実装しています。
ユーザが無効の場合は別ページにリダイレクトして、
ユーザが有効の場合は通常にログインさせたいのですが、エラーになってしまいます。
Controller で以下の処理を実装しているのですが、どうやってログイン処理を実装していいのか分かりません。
助けてください。


public function action_do_login()
{
$ui = UserInfo::getByUserName($this->get('uName'));
if(!$ui->isActive()){
$this->redirect('/270');
} else {
$this->set('uName', $this->get('uName'));
$this->set('uPassword', $this->get('uPassword'));

$url = View::url('/login', 'authenticate', 'concrete');
$data = array(
'uName' => $this->get('uName'),
'uPassword' => $this->get('uPassword'),
'ccm_token' => $this->get('ccm_token')
);
$content = http_build_query($data);
$options = array('http' => array(
'method' => 'POST',
'content' => $content
));
$contents = file_get_contents($url, false, stream_context_create($options));
}
}

タグ: