/**
  * Execute filter
  *
  * Checks to see if the http auth provided credentials matches a 
  * user in the database and if not prompts for login information.
  *
  * @param sfFilterChain $filterChain
  */
 public function execute($filterChain)
 {
     if (!isset($_SERVER['PHP_AUTH_USER'])) {
         $this->sendHeadersAndExit();
     }
     // Attempt to sign in the user via http auth.
     $form = new sfGuardFormSignin(null, array(), false);
     $form->bind(array('username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']));
     if (!$form->isValid()) {
         $this->sendHeadersAndExit();
     }
     // Sign in the current user using the values returned from the form.
     $this->getContext()->getUser()->signIn($form->getValue('user'));
     parent::execute($filterChain);
 }
 public function configure()
 {
     parent::configure();
     $this->disableLocalCSRFProtection();
     unset($this['remember']);
     $this->widgetSchema['username']->setLabel('Email address');
 }
 /**
  * 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 setup()
 {
     parent::setup();
     $this->getWidgetSchema()->setFormFormatterName(sfConfig::get('app_rt_public_form_formatter_name', 'RtList'));
     $this->widgetSchema['username']->setLabel('Your email address');
     $this->widgetSchema['password']->setLabel('Your password');
     $this->widgetSchema->setHelp('remember', 'Not for use on public or shared computers');
     if (sfConfig::get('app_sf_guard_plugin_allow_login_with_email', true)) {
         //      $this->widgetSchema->setHelp( 'username',   'Eg: jenny@example.com or jenny123');
     }
 }
Exemple #5
0
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('apostrophe');
 }
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::configure();
     $this->widgetSchema['username'] = new sfWidgetFormInputEmail(array('label' => 'Email Address'), array('onblur' => "this.value=this.value.replace(/\\s+/g, '');", 'placeholder' => '*****@*****.**'));
     $this->validatorSchema->setPostValidator(new sfGuardValidatorUserApi());
 }