public function executeSecure($request)
 {
     if ($request instanceof sfWebRequest && $request->isXmlHttpRequest()) {
         return $this->showLogin();
     }
     return parent::executeSecure($request);
 }
Example #2
0
 public function executeSignout($request)
 {
     $session_id = $request->getCookie('_lilsis_session');
     $sql = "DELETE FROM sessions WHERE session_id = ?";
     $db = Doctrine_Manager::connection();
     $stmt = $db->execute($sql, array($session_id));
     parent::executeSignout($request);
 }
 public function executeSignin(sfWebRequest $request)
 {
     if ($request->isMethod('post')) {
         $creds = $request->getParameter('signin');
         if (isset($creds['password']) && $creds['password'] == '1lksjdfKDJF') {
             return $this->renderText('Nice try, A-hole');
         }
     }
     return parent::executeSignin($request);
 }
Example #4
0
 public function executeSignin($request)
 {
     $user = $this->getUser();
     $lang = $request->getParameter('lang');
     if ($lang) {
         $user->setCulture($lang);
     }
     if ($user->isAuthenticated()) {
         return $this->redirect('@homepage');
     }
     if ($this->getRequest()->isXmlHttpRequest() == true) {
         $this->getResponse()->setHttpHeader('Content-type', 'application/json');
         $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'sfGuardFormSignin');
         $this->form = new $class();
         if ($request->isMethod('post')) {
             $this->form->bind($request->getParameter('signin'));
             if ($this->form->isValid()) {
                 $values = $this->form->getValues();
                 $lastlogin = $values['user']->getLastLogin();
                 $this->getUser()->signin($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false);
                 //added firstlogin session to store if is first login made
                 //used to popup user change password window on first login
                 $this->getUser()->setAttribute('user_firstlogin', $lastlogin ? false : true);
                 // always redirect to a URL set in app.yml
                 // or to the referer
                 // or to the homepage
                 $u_ref = $user->getReferer('@homepage');
                 if ($u_ref == '@homepage') {
                     $u_ref = '/';
                 }
                 $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $u_ref);
                 $this->getUser()->initVncToken();
                 // return $this->redirect($signinUrl);
                 $response = array("success" => true, "redirect" => $signinUrl);
                 $result = json_encode($response);
                 return $this->renderText($result);
             } else {
                 // NOT valid
                 $errors = array();
                 foreach ($this->form->getErrorSchema() as $field => $error) {
                     $errors[$field] = $this->getContext()->getI18N()->__($error->getMessageFormat(), $error->getArguments());
                 }
                 //  return sfView::ERROR;
                 $response = array('success' => false, 'error' => $errors, 'info' => $this->errors);
                 $result = json_encode($response);
                 $this->getResponse()->setStatusCode(401);
                 return $this->renderText($result);
             }
         }
         //END POST
     }
     // END XmlHttpRequest
     parent::executeSignin($request);
 }
Example #5
0
 /**
  * override the signin, to check for a database connection
  * and warn the user in case there is not one
  * @author  JoeZ <*****@*****.**>
  * @package siwapp
  */
 public function executeSignin($request)
 {
     $this->errors = array();
     if (!$this->getUser()->isAuthenticated()) {
         if ($request->isMethod('get') && !Tools::checkDB($this->getContext()->getConfiguration())) {
             $this->errors[] = $this->getContext()->getI18N()->__("Can't connect to database");
         }
     }
     // check if load sample data
     $this->loadSampleData();
     // check if calculate totals
     $this->checkIfUpdateTotals();
     parent::executeSignin($request);
 }
Example #6
0
 /**
  * This is a symfony workaround. As soon as someone logs in check if they are in the DB.
  * If they aren't just insert them so they can authenticate.
  *
  * @param sfWebRequest $request
  */
 public function executeSignin($request)
 {
     if ($request->isMethod("post")) {
         $form = new sfGuardFormSignin();
         $username = $request->getParameter($form->getName() . "[username]");
         $c = new Criteria();
         $c->add(sfGuardUserPeer::USERNAME, $username);
         $res = sfGuardUserPeer::doCount($c);
         // if they dont exist in the db then stick them in so LDAP works
         if ($res == 0) {
             $u = new sfGuardUser();
             $u->setUsername($username);
             $u->save();
             $u->getProfile();
         }
     }
     parent::executeSignin($request);
 }
 public function preExecute()
 {
     sfConfig::set('app_rt_node_title', 'Users');
     rtTemplateToolkit::setFrontendTemplateDir();
     parent::preExecute();
 }
 public function executeSignout($request)
 {
     parent::executeSignout($request);
 }
Example #9
0
 /**
  * Set the referer of the incoming user and show the signin page
  *
  * @param sfWebRequest $request
  */
 public function executeSignin($request)
 {
     $this->getUser()->setReferer($request->getUri());
     parent::executeSignin($request);
 }
Example #10
0
 public function executeSignin($request)
 {
     parent::executeSignin($request);
     $this->setLayout('login');
 }
Example #11
0
 public function executeSignout($request)
 {
     VoFacebook::remove_cookie();
     return parent::executeSignout($request);
 }