Author: allyb
Date: 2010-03-02 21:21:10 +0100 (Tue, 02 Mar 2010)
New Revision: 28351
Modified:
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/lib/user/sfEasyAuthSecurityUser.class.php
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
Log:
Added a method to the Security User to retrieve the url users should be
redirected to after logging in
Modified:
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/lib/user/sfEasyAuthSecurityUser.class.php
===================================================================
---
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/lib/user/sfEasyAuthSecurityUser.class.php
2010-03-02 18:13:54 UTC (rev 28350)
+++
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/lib/user/sfEasyAuthSecurityUser.class.php
2010-03-02 20:21:10 UTC (rev 28351)
@@ -292,6 +292,33 @@
}
/**
+ * Returns the url to redirect the user to after logging in
+ *
+ * @return string $url The URL to redirect a user to after logging in
+ */
+ public function getRedirectUrl()
+ {
+ // get the default url as set in app.yml or just to the homepage
+ $url = sfConfig::get('app_sf_easy_auth_login_success_url', '@homepage');
+
+ // if the original url the user was trying to access was saved, redirect
them
+ // there instead
+ $url = ($this->getAttribute('sf_easy_auth.restricted_url')) ?
+ $this->getAttribute('sf_easy_auth.restricted_url') : $url;
+
+ // call an event in case other code wants to change the url
+ $url = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(
+ $this,
+ 'sf_easy_auth.filter_login_redirect_url',
+ array(
+ 'sfUser' => $this,
+ )
+ ), $url)->getReturnValue();
+
+ return $url;
+ }
+
+ /**
* Refreshes the credentials this sfUser has
*/
public function refreshCredentials()
Modified:
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
===================================================================
---
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
2010-03-02 18:13:54 UTC (rev 28350)
+++
plugins/sfEasyAuthPlugin/branches/2010-02-18_integration-of-doctrine/modules/sfEasyAuth/lib/BasesfEasyAuthActions.class.php
2010-03-02 20:21:10 UTC (rev 28351)
@@ -39,31 +39,15 @@
if ($this->handleLogIn($request))
{
- // log in successful, so redirect
- // to a URL set in app.yml
- // or to the homepage
- $url = sfConfig::get('app_sf_easy_auth_login_success_url', '@homepage');
-
- // if the original url the user was trying to access was saved, redirect
them
- // there
- $url = ($this->getUser()->getAttribute('sf_easy_auth.restricted_url')) ?
- $this->getUser()->getAttribute('sf_easy_auth.restricted_url') : $url;
+ // log in successful, so redirect the user
+ $url = $sfUser->getRedirectUrl();
- // call an event after logging the user out and before redirecting them
- $url = $this->getContext()->getEventDispatcher()->filter(new sfEvent(
- $this,
- 'sf_easy_auth.filter_login_redirect_url',
- array(
- 'sfUser' => $sfUser,
- )
- ), $url)->getReturnValue();
-
$this->logMessage("Redirecting user to $url", 'debug');
$this->redirect($url);
}
}
-
+
/**
* Handles both ordinary log-ins and when a user requires more credentials
*
--
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.