Modified:
trunk/Lux/Auth/Adapter/Psql.php
Log:
Optimized a bit the logic in start(): no need to call isValid() and
isLoginRequest() multiple times.
Modified: trunk/Lux/Auth/Adapter/Psql.php
==============================================================================
--- trunk/Lux/Auth/Adapter/Psql.php (original)
+++ trunk/Lux/Auth/Adapter/Psql.php Thu Sep 25 22:33:03 2008
@@ -126,25 +126,27 @@
// update idle and expire times no matter what
$this->updateIdleExpire();
- // if current auth **is not** valid, and processing is allowed,
- // process login attempts
- if (! $this->isValid() && $this->allow && $this->isLoginRequest())
{
- $this->processLogin();
- if ($this->isValid()) {
- // was a valid login, attempt to redirect.
- $this->_redirect();
- }
- }
-
- // if auth it not valid, processing is allowed and this is not
- // a login attempt, try to login with cookie
- if (! $this->isValid() && $this->allow && !
$this->isLoginRequest()) {
- $this->_processCookieLogin();
+ // don't proceed if not allowed
+ if (! $this->allow) {
+ return;
}
- // if current auth **is** valid, and processing is allowed,
- // process logout attempts, and redirect if requested.
- if ($this->isValid() && $this->allow && $this->isLogoutRequest()) {
+ // if current auth **is not** valid, process login attempts
+ if (! $this->isValid()) {
+ if ($this->isLoginRequest()) {
+ $this->processLogin();
+ if ($this->isValid()) {
+ // was a valid login, attempt to redirect.
+ $this->_redirect();
+ }
+ } else {
+ // if current auth **is not** valid and
+ // this is not a login attempt, try to login with cookie
+ $this->_processCookieLogin();
+ }
+ } elseif ($this->isLogoutRequest()) {
+ // if current auth **is** valid,
+ // process logout attempts, and redirect if requested.
$this->processLogout();
$this->_redirect();
}