Development

Changeset 18572

You must first sign up to be able to contribute.

Changeset 18572

Show
Ignore:
Timestamp:
05/22/09 23:59:14 (4 years ago)
Author:
Nathan.Vonnahme
Message:

Doctrine changes from Todd McNeill?

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/bhLDAPAuthPlugin/branches/1.2_Doctrine/modules/bhLDAPAuth/actions/actions.class.php

    r14052 r18572  
    11<?php 
    2  
    3  
    4 require_once(sfConfig::get('sf_plugins_dir').'/sfGuardPlugin/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php'); 
    5  
    6  
     2require_once(sfConfig::get('sf_plugins_dir').'/sfDoctrineGuardPlugin/modules/sfGuardAuth/lib/BasesfGuardAuthActions.class.php'); 
    73 
    84/** 
     
    1814  public function executeSignin($request) 
    1915  { 
    20     bhLDAP::debug("########  hello bhLDAPAuthActions::executeSignin"); 
     16    bhLDAP::debug("########  hello my actions!"); 
    2117 
    2218    $user = $this->getUser(); 
    23     if ($user->isAuthenticated()) 
    24     { 
    25       bhLDAP::debug("########  logged in!  redirectifying to homepage"); 
    26       return $this->redirect('@homepage'); 
    27     } 
    28  
    29 /*     bhLDAP::debugDump($user, 'the user'); */ 
    30  
    31  
    32     $class = sfConfig::get('app_sf_guard_plugin_signin_form', 'bhLDAPAuthFormSignin'); 
     19    //bhLDAP::debugDump($user, 'the user');  
     20     
     21    $class = sfConfig::get('app_bh_ldap_plugin_signin_form', 'bhLDAPFormSignin'); 
    3322    $this->form = new $class(); 
    34  
    35     bhLDAP::debug("########  Request Method = " . $request->getMethodName()); 
    36  
    3723 
    3824    if ($request->isMethod('post')) 
    3925    { 
    40       bhLDAP::debug("########  a login attempt!  signing in (if validation passed) and redirectifying to homepage or wherever"); 
     26      bhLDAP::debug("########  a log in attempt!  signing in (if validation passed) and redirectifying to homepage or wherever"); 
     27      $this->form->bind($request->getParameter('signin')); 
    4128 
    42  
    43  
    44  
    45       $this->form->bind($request->getParameter('signin')); 
    4629      if ($this->form->isValid()) 
    4730      { 
    48         $values = $this->form->getValues(); 
    49         $this->getUser()->signIn($values['user'], array_key_exists('remember', $values) ? $values['remember'] : false); 
     31        bhLDAP::debug("####### Form is valid."); 
    5032 
    51         // always redirect to a URL set in app.yml 
    52         // or to the referer 
    53         // or to the homepage 
    54         $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user->getReferer('@homepage')); 
     33        $values   = $this->form->getValues(); 
     34        $remember = isset($values['remember']) ? $values['remember'] : false; 
    5535 
    56         return $this->redirect($signinUrl); 
     36        $this->getUser()->signin($values['user'], $remember); 
     37 
     38        $signinUrl = sfConfig::get('app_sf_guard_plugin_success_signin_url', $user->getReferer($request->getReferer())); 
     39 
     40        return $this->redirect('' != $signinUrl ? $signinUrl : '@homepage'); 
    5741      } 
    58      
     42      else 
     43      { 
     44        bhLDAP::debug("####### Form is not valid."); 
     45      } 
     46    } 
     47    elseif ($user->isAuthenticated()) 
     48    { 
     49      bhLDAP::debug("########  logged in!  redirectifying to homepage"); 
     50 
     51      $this->redirect('@homepage'); 
    5952    } 
    6053    else 
    6154    { 
    62       bhLDAP::debug("########  not a POST!  redirecting to signin form"); 
    63  
     55      bhLDAP::debug("########  not a POST!  redirectifying to signin form"); 
    6456      if ($this->getRequest()->isXmlHttpRequest()) 
    6557      { 
     
    7062      } 
    7163 
    72  
    73       // if we have been forwarded, then the referer is the current URL 
    74       // if not, this is the referer of the current request 
    75       $user->setReferer($this->getContext()->getActionStack()->getSize() > 1 ? $request->getUri() : $request->getReferer()); 
     64      if (!$user->hasAttribute('referer')) 
     65      { 
     66        $user->setAttribute('referer', $this->getRequest()->getReferer()); 
     67      } 
    7668 
    7769      if ($this->getModuleName() != ($module = sfConfig::get('sf_login_module')))