public function DisplayForm()
 {
     # display form, with the error control included because it may contain an action button
     $form = new SignInForm($this->GetSettings(), $this->GetAuthenticationManager());
     $form->SetControls(array_unshift($form->GetControls(), $this->o_error_list));
     echo $form;
 }
Example #2
0
 public function executeSignIn($request)
 {
     # new form
     $form = new SignInForm();
     $form->bind($request->getParameter($form->getName()));
     if ($form->isValid()) {
         $user = Doctrine::getTable('PublicUser')->findOneByCredentials($form->getValue('username'), $form->getValue('password'));
         if ($user) {
             $this->getUser()->authAs($user);
         }
     }
     # if user is still not authenticated => set flashes
     if (!$this->getUser()->isAuthenticated()) {
         $this->getUser()->setFlash($request->getParameter('message', 'signin.error'), 'username or password is wrong');
     } else {
         $this->dispatcher->notify(new sfEvent($this, 'user.signed_in'));
     }
     $add = $request->hasParameter('anchor') ? '#' . $request->getParameter('anchor', '') : '';
     $this->redirect($request->getReferer() . $add);
 }