는 다음을 수행하십시오
$this->getUser()->signin($sfGuardUserObject);
당신은 sfGuardUser의 객체로 호출해야한다. 이 코드를 모듈의 preExecute() 메소드에 넣어 각 요청을 확인할 수 있습니다.
나는 "계정 활성화"작업을 수행 할 때 비슷한 작업을 수행했습니다. 계정 생성 후 토큰이있는 전자 메일은 사이트로 다시 연결됩니다. 토큰은 URL로 전송되고 액션 경로와 일치합니다. 그런 다음 사용자가 해당 토큰을 가지고 있는지 확인한 다음 사용자를 기록합니다. 내가 한 일입니다.
public function executeActivate(sfWebRequest $request)
{
// if token is not present, forward to 404
$this->forward404Unless($request->getParameter('token'), 'page', 'index');
$this->profile = sfGuardUserProfilePeer::activateProfileByToken($request->getParameter('token'));
// if someone was activated, return the mobile activation form and success page
if (!$this->profile)
{
$this->redirect404();
}
// sign the user in
$this->getUser()->signin($this->profile->getsfGuardUser());
// set the $user variable for the template
$this->user = $this->profile->getsfGuardUser();
}
희망이 있습니다.
좋은 답변입니다. BTW,'sfAction :: forward404If'는 당신이 그것에 대해 모른다면 편리한 방법입니다. –
미안하지만 대답하지 않고서는이 모든 시간 동안 미안 해요, 조금 바빴습니다. 요즘 내가했던 것을 기억하지 못합니다.하지만 정답으로 답을 표시 할 것입니다. 합법적 인 소리, 감사합니다 .-) – markcial