aboutsummaryrefslogtreecommitdiff
path: root/login.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-25 15:57:29 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-11-25 15:57:29 +0000
commit15b91c7e661d928d8b125ec9cfbda1702319c8b4 (patch)
tree092d474c05e414bb04a8c428b8ff6cb9ccab765d /login.php
parent9aafe7551eb5a73739709e72465031db7a1531b4 (diff)
downloadsemanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.gz
semanticscuttle-15b91c7e661d928d8b125ec9cfbda1702319c8b4.tar.bz2
Major refactoring: transform user into object, define parameters used into each file, ...
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@173 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'login.php')
-rw-r--r--login.php29
1 files changed, 20 insertions, 9 deletions
diff --git a/login.php b/login.php
index f09996e..b1b9fcb 100644
--- a/login.php
+++ b/login.php
@@ -20,20 +20,32 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
***************************************************************************/
require_once('header.inc.php');
+
+
+/* Service creation: only useful services are created */
$userservice =& ServiceFactory::getServiceInstance('UserService');
$templateservice =& ServiceFactory::getServiceInstance('TemplateService');
+
+/* Managing all possible inputs */
+isset($_POST['keeppass']) ? define('POST_KEEPPASS', $_POST['keeppass']): define('POST_KEEPPASS', '');
+isset($_POST['submitted']) ? define('POST_SUBMITTED', $_POST['submitted']): define('POST_SUBMITTED', '');
+isset($_POST['username']) ? define('POST_USERNAME', $_POST['username']): define('POST_USERNAME', '');
+isset($_POST['password']) ? define('POST_PASSWORD', $_POST['password']): define('POST_PASSWORD', '');
+isset($_POST['query']) ? define('POST_QUERY', $_POST['query']): define('POST_QUERY', '');
+
+
$tplVars = array();
-$keeppass = isset($_POST['keeppass'])&&($_POST['keeppass']=='yes')?true:false;
+$keeppass = (POST_KEEPPASS=='yes')?true:false;
$login = false;
-if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['password'])) {
- $posteduser = trim(utf8_strtolower($_POST['username']));
- $login = $userservice->login($posteduser, $_POST['password'], $keeppass);
+if (POST_SUBMITTED!='' && POST_USERNAME!='' && POST_PASSWORD!='') {
+ $posteduser = trim(utf8_strtolower(POST_USERNAME));
+ $login = $userservice->login($posteduser, POST_PASSWORD, $keeppass);
if ($login) {
- if ($_POST['query'])
- header('Location: '. createURL('bookmarks', $posteduser .'?'. $_POST['query']));
+ if (POST_QUERY)
+ header('Location: '. createURL('bookmarks', $posteduser .'?'. POST_QUERY));
else
header('Location: '. createURL('bookmarks', $posteduser));
} else {
@@ -42,9 +54,8 @@ if (isset($_POST['submitted']) && isset($_POST['username']) && isset($_POST['pas
}
if (!$login) {
if ($userservice->isLoggedOn()) {
- $cUser = $userservice->getCurrentUser();
- $cUsername = strtolower($cUser[$userservice->getFieldName('username')]);
- header('Location: '. createURL('bookmarks', $cUsername));
+ $cUser = $userservice->getCurrentObjectUser();
+ header('Location: '. createURL('bookmarks', strtolower($cUser->getUsername())));
}
$tplVars['subtitle'] = T_('Log In');