Author: agilbert
Date: 2010-04-26 18:53:54 +0200 (Mon, 26 Apr 2010)
New Revision: 29266

Added:
   plugins/sfShibbolethPlugin/branches/1.4/lib/form/
   
plugins/sfShibbolethPlugin/branches/1.4/lib/form/sfShibbolethFakeUserForm.class.php
Removed:
   plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethDemoHome/
Modified:
   
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/actions/actions.class.php
   
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/templates/loginSuccess.php
Log:
project:validate is happy now on 1.4

Added: 
plugins/sfShibbolethPlugin/branches/1.4/lib/form/sfShibbolethFakeUserForm.class.php
===================================================================
--- 
plugins/sfShibbolethPlugin/branches/1.4/lib/form/sfShibbolethFakeUserForm.class.php
                         (rev 0)
+++ 
plugins/sfShibbolethPlugin/branches/1.4/lib/form/sfShibbolethFakeUserForm.class.php
 2010-04-26 16:53:54 UTC (rev 29266)
@@ -0,0 +1,18 @@
+<?php
+
+class sfShibbolethFakeUserForm extends sfForm
+{
+  public function configure()
+  {
+    $fakeUsers = sfConfig::get('app_sfShibboleth_fake_users', false);
+    $options = array();
+    foreach ($fakeUsers as $id => $data) 
+    {
+      $options[$id] = $data['display_name'];
+    }
+    
+    $this->setWidgets(array(
+      'fake_user' => new sfWidgetFormSelect(array('choices' => $options)),
+    ));
+  }
+}
\ No newline at end of file

Modified: 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/actions/actions.class.php
===================================================================
--- 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/actions/actions.class.php
  2010-04-26 16:28:52 UTC (rev 29265)
+++ 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/actions/actions.class.php
  2010-04-26 16:53:54 UTC (rev 29266)
@@ -43,30 +43,37 @@
     // test users in a manner that exercises the code in 
     // the shibboleth filter just as much as real Shibboleth would.
 
-    if (sfConfig::get('app_sfShibboleth_fake', false)) {
+    if (sfConfig::get('app_sfShibboleth_fake', false)) 
+    {
       // Let them pick a fake user
       $fakeUsers = sfConfig::get('app_sfShibboleth_fake_users', false);
-      if (!$fakeUsers) {
+      if (!$fakeUsers)
+      {
         return $this->forward404();
       }
-      $this->options = array();
-      foreach ($fakeUsers as $id => $data) 
+      
+      if ($this->hasRequestParameter('fake_user'))
       {
-        $this->options[$id] = $data['display_name'];
-      }
-      if ($this->hasRequestParameter('fake_user')) {
         $fakeUser = $this->getRequestParameter('fake_user'); 
-        if (!isset($fakeUsers[$fakeUser])) {
+        if (!isset($fakeUsers[$fakeUser]))
+        {
           return $this->forward404();
         }
+        
         $fakeDisplayName = $fakeUsers[$fakeUser]['display_name'];
         $sfUser->setAttribute('sfShibboleth_fake_user', $fakeUser);
         $sfUser->setAttribute('sfShibboleth_fake_display_name', 
$fakeDisplayName);
-      } else {
+      }
+      else
+      {
         // Display the fake user picker
+        $this->form = new sfShibbolethFakeUserForm();
+
         return sfView::SUCCESS;
       }
-    } else {
+    }
+    else
+    {
       if (!isset($_SERVER['REMOTE_USER'])) 
       {
         $shim = sfConfig::get('app_sfShibboleth_shim', false);
@@ -81,6 +88,7 @@
         }
       }
     }
+
     // DON'T try to set this to the referrer here. In a true
     // Shibboleth environment, a redirect to Shibboleth will
     // already have ruined that option. See sfShibbolethDemoHome for an
@@ -88,8 +96,10 @@
     // YOUR OWN login action which then redirects to this action.
     $after = $sfUser->getAttribute('sfShibboleth_after', '@homepage');
     $sfUser->setAttribute('sfShibboleth_after', null);
+
     return $this->redirect($after);
   }
+  
   // This action signs the user out of Symfony, and then out of
   // Shibboleth as well. In production the latter is done by redirecting
   // to the Shibboleth logout URL. If your Apache configuration uses

Modified: 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/templates/loginSuccess.php
===================================================================
--- 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/templates/loginSuccess.php
 2010-04-26 16:28:52 UTC (rev 29265)
+++ 
plugins/sfShibbolethPlugin/branches/1.4/modules/sfShibbolethAuth/templates/loginSuccess.php
 2010-04-26 16:53:54 UTC (rev 29266)
@@ -1,9 +1,3 @@
-<?php
-  // Never seen in staging/production, which use
-  // real Shibboleth logins. TBB
-
-  use_helper('Form');
-?>
 <h2>
 Please Select a Test User
 </h2>
@@ -13,8 +7,8 @@
 set <tt>app_shibboleth_fake</tt> to <tt>false</tt> in app.yml to
 preserve the security of your site!
 </p>
-<?php echo form_tag('sfShibbolethAuth/login') ?> 
-<?php echo select_tag('fake_user',
-  options_for_select($options, false)) ?>
-<?php echo submit_tag('Go', array("class" => "submit")) ?>
+
+<form action="<?php url_for('sfShibbolethAuth/login') ?>" method="post">
+<?php echo $form ?>
+<input type="submit" name="go" value="Go" class="submit">
 </form>

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to