2b004b473a7ab8ab98d8d7eb7aa2aefe74a82fd5
[mobi/.git] /
1 <?php
2
3 class BasesfGuardRegisterActions extends sfActions
4 {
5   public function executeIndex(sfWebRequest $request)
6   {
7     if ($this->getUser()->isAuthenticated())
8     {
9       $this->getUser()->setFlash('notice', 'You are already registered and signed in!');
10       $this->redirect('@homepage');
11     }
12
13     $this->form = new sfGuardRegisterForm();
14
15     if ($request->isMethod('post'))
16     {
17       $this->form->bind($request->getParameter($this->form->getName()));
18       if ($this->form->isValid())
19       {
20         $user = $this->form->save();
21         $this->getUser()->signIn($user);
22
23         $this->redirect('@homepage');
24       }
25     }
26   }
27 }