From 903ae8a581fac1e6917fc3e31d2ad8fb91df80c3 Mon Sep 17 00:00:00 2001 From: ctrlaltca <> Date: Thu, 12 Jul 2012 11:21:01 +0000 Subject: standardize the use of unix eol; use svn properties to enforce native eol --- .../protected/App_Code/TrackerAuthManager.php | 168 ++++++++++----------- 1 file changed, 84 insertions(+), 84 deletions(-) (limited to 'demos/time-tracker/protected/App_Code/TrackerAuthManager.php') diff --git a/demos/time-tracker/protected/App_Code/TrackerAuthManager.php b/demos/time-tracker/protected/App_Code/TrackerAuthManager.php index 989fcc54..ea6b5aab 100644 --- a/demos/time-tracker/protected/App_Code/TrackerAuthManager.php +++ b/demos/time-tracker/protected/App_Code/TrackerAuthManager.php @@ -1,85 +1,85 @@ - - * @version $Id$ - * @package Demos - * @since 3.1 - */ -class TrackerAuthManager extends TAuthManager -{ - /** - * @const string signon token cookie name. - */ - const SignonCookieName = 'time-tracker-signon'; - - /** - * Performs the real authentication work. Overrides and calls parent - * implementation. Trys to authenticate using token saved in cookie. - * @param mixed parameter to be passed to OnAuthenticate event - */ - public function onAuthenticate($param) - { - parent::onAuthenticate($param); - $currentUser = $this->Application->User; - if(!$currentUser || $currentUser->IsGuest) - $this->authenticateFromCookie($param); - } - - /** - * If the user is not set or is still a guest, try to authenticate the user - * using a string token saved in the cookie if any. - * @param mixed parameter to be passed to OnAuthenticate event - */ - protected function authenticateFromCookie($param) - { - $cookie = $this->Request->Cookies[self::SignonCookieName]; - if(!is_null($cookie)) - { - $daos = $this->getApplication()->getModule('daos'); - $userDao = $daos->getDao('UserDao'); - $user = $userDao->validateSignon($cookie->Value); - if($user instanceof TimeTrackerUser) - $this->updateCredential($user); - } - } - - /** - * Changes the user credentials. - * @param TUser new user details. - */ - public function updateCredential($user) - { - $user->IsGuest = false; - $this->updateSessionUser($user); - $this->Application->User = $user; - } - - /** - * Generate a token to be saved in the cookie for later authentication. - * @param TimeTrackerUser user details. - */ - public function rememberSignon($user) - { - $daos = $this->getApplication()->getModule('daos'); - $userDao = $daos->getDao('UserDao'); - $token = $userDao->createSignonToken($user); - $cookie = new THttpCookie(self::SignonCookieName, $token); - $cookie->Expire = strtotime('+1 month'); - $this->Response->Cookies[] = $cookie; - } - - /** - * Logs out the user and delete the token from cookie. - */ - public function logout() - { - parent::logout(); - $cookie = new THttpCookie(self::SignonCookieName,''); - $this->Response->Cookies[] = $cookie; - } -} - + + * @version $Id$ + * @package Demos + * @since 3.1 + */ +class TrackerAuthManager extends TAuthManager +{ + /** + * @const string signon token cookie name. + */ + const SignonCookieName = 'time-tracker-signon'; + + /** + * Performs the real authentication work. Overrides and calls parent + * implementation. Trys to authenticate using token saved in cookie. + * @param mixed parameter to be passed to OnAuthenticate event + */ + public function onAuthenticate($param) + { + parent::onAuthenticate($param); + $currentUser = $this->Application->User; + if(!$currentUser || $currentUser->IsGuest) + $this->authenticateFromCookie($param); + } + + /** + * If the user is not set or is still a guest, try to authenticate the user + * using a string token saved in the cookie if any. + * @param mixed parameter to be passed to OnAuthenticate event + */ + protected function authenticateFromCookie($param) + { + $cookie = $this->Request->Cookies[self::SignonCookieName]; + if(!is_null($cookie)) + { + $daos = $this->getApplication()->getModule('daos'); + $userDao = $daos->getDao('UserDao'); + $user = $userDao->validateSignon($cookie->Value); + if($user instanceof TimeTrackerUser) + $this->updateCredential($user); + } + } + + /** + * Changes the user credentials. + * @param TUser new user details. + */ + public function updateCredential($user) + { + $user->IsGuest = false; + $this->updateSessionUser($user); + $this->Application->User = $user; + } + + /** + * Generate a token to be saved in the cookie for later authentication. + * @param TimeTrackerUser user details. + */ + public function rememberSignon($user) + { + $daos = $this->getApplication()->getModule('daos'); + $userDao = $daos->getDao('UserDao'); + $token = $userDao->createSignonToken($user); + $cookie = new THttpCookie(self::SignonCookieName, $token); + $cookie->Expire = strtotime('+1 month'); + $this->Response->Cookies[] = $cookie; + } + + /** + * Logs out the user and delete the token from cookie. + */ + public function logout() + { + parent::logout(); + $cookie = new THttpCookie(self::SignonCookieName,''); + $this->Response->Cookies[] = $cookie; + } +} + ?> \ No newline at end of file -- cgit v1.2.3