Everybody gets a session.
This commit is contained in:
parent
4bd546b81d
commit
0e9531c0b5
2 changed files with 18 additions and 8 deletions
|
|
@ -259,7 +259,7 @@ sub www_deactivateAccountConfirm {
|
||||||
my ($u);
|
my ($u);
|
||||||
if ($session{user}{userId} < 26) {
|
if ($session{user}{userId} < 26) {
|
||||||
return WebGUI::Privilege::vitalComponent();
|
return WebGUI::Privilege::vitalComponent();
|
||||||
} elsif (($session{user}{userId} != 1) and $session{setting}{selfDeactivation}) {
|
} elsif ($session{setting}{selfDeactivation}) {
|
||||||
$u = WebGUI::User->new($session{user}{userId});
|
$u = WebGUI::User->new($session{user}{userId});
|
||||||
$u->status("Selfdestructed");
|
$u->status("Selfdestructed");
|
||||||
WebGUI::Session::end($session{var}{sessionId});
|
WebGUI::Session::end($session{var}{sessionId});
|
||||||
|
|
@ -302,7 +302,7 @@ sub www_displayAccount {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_displayLogin {
|
sub www_displayLogin {
|
||||||
my ($output, $f);
|
my ($output, $f);
|
||||||
if ($session{var}{sessionId}) {
|
if ($session{user}{userId} != 1) {
|
||||||
$output .= www_displayAccount();
|
$output .= www_displayAccount();
|
||||||
} else {
|
} else {
|
||||||
$output .= '<h1>'.WebGUI::International::get(66).'</h1>';
|
$output .= '<h1>'.WebGUI::International::get(66).'</h1>';
|
||||||
|
|
@ -431,7 +431,7 @@ sub www_login {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($success == 1) {
|
if ($success == 1) {
|
||||||
WebGUI::Session::start($uid);
|
WebGUI::Session::convertVisitorToUser($session{var}{sessionId},$uid);
|
||||||
$u->karma($session{setting}{karmaPerLogin},"Login","Just for logging in.") if ($session{setting}{useKarma});
|
$u->karma($session{setting}{karmaPerLogin},"Login","Just for logging in.") if ($session{setting}{useKarma});
|
||||||
_logLogin($uid,"success");
|
_logLogin($uid,"success");
|
||||||
return "";
|
return "";
|
||||||
|
|
@ -450,7 +450,7 @@ sub www_logout {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_recoverPassword {
|
sub www_recoverPassword {
|
||||||
my ($output, $f);
|
my ($output, $f);
|
||||||
if ($session{var}{sessionId}) {
|
if ($session{user}{userId} != 1) {
|
||||||
$output .= www_displayAccount();
|
$output .= www_displayAccount();
|
||||||
} else {
|
} else {
|
||||||
$output .= '<h1>'.WebGUI::International::get(71).'</h1>';
|
$output .= '<h1>'.WebGUI::International::get(71).'</h1>';
|
||||||
|
|
@ -506,7 +506,7 @@ sub www_recoverPasswordFinish {
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub www_updateAccount {
|
sub www_updateAccount {
|
||||||
my ($output, $error, $encryptedPassword, $passwordStatement, $u);
|
my ($output, $error, $encryptedPassword, $passwordStatement, $u);
|
||||||
if ($session{var}{sessionId}) {
|
if ($session{user}{userId} != 1) {
|
||||||
if ($session{form}{identifier1} ne "password") {
|
if ($session{form}{identifier1} ne "password") {
|
||||||
$error = _hasBadPassword($session{form}{identifier1},$session{form}{identifier2});
|
$error = _hasBadPassword($session{form}{identifier1},$session{form}{identifier2});
|
||||||
unless ($error) {
|
unless ($error) {
|
||||||
|
|
|
||||||
|
|
@ -208,6 +208,13 @@ sub close {
|
||||||
$ENV{PATH_INFO} = "/"; #work around to fix a bug in mod_perl (win32)
|
$ENV{PATH_INFO} = "/"; #work around to fix a bug in mod_perl (win32)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------
|
||||||
|
sub convertVisitorToUser {
|
||||||
|
WebGUI::SQL->write("update userSession set userId=$_[1] where sessionId=".quote($_[0]));
|
||||||
|
$session{var}{userId} = $_[1];
|
||||||
|
refreshUserInfo($_[1]);
|
||||||
|
}
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
sub end {
|
sub end {
|
||||||
WebGUI::SQL->write("delete from userSession where sessionId='$_[0]'",$session{dbh});
|
WebGUI::SQL->write("delete from userSession where sessionId='$_[0]'",$session{dbh});
|
||||||
|
|
@ -319,7 +326,11 @@ sub open {
|
||||||
}
|
}
|
||||||
###----------------------------
|
###----------------------------
|
||||||
### session variables
|
### session variables
|
||||||
_setupSessionVars($session{cookie}{wgSession},$session{setting}{sessionTimeout});
|
if ($session{cookie}{wgSession} eq "") {
|
||||||
|
start(1); #setting up a visitor session
|
||||||
|
} else {
|
||||||
|
_setupSessionVars($session{cookie}{wgSession},$session{setting}{sessionTimeout});
|
||||||
|
}
|
||||||
###----------------------------
|
###----------------------------
|
||||||
### current user's account and profile information (from users and userProfileData tables)
|
### current user's account and profile information (from users and userProfileData tables)
|
||||||
_setupUserInfo($session{var}{userId});
|
_setupUserInfo($session{var}{userId});
|
||||||
|
|
@ -403,8 +414,7 @@ sub start {
|
||||||
my ($sessionId);
|
my ($sessionId);
|
||||||
$sessionId = _generateSessionId();
|
$sessionId = _generateSessionId();
|
||||||
WebGUI::SQL->write("insert into userSession values ('$sessionId', ".
|
WebGUI::SQL->write("insert into userSession values ('$sessionId', ".
|
||||||
(time()+$session{setting}{sessionTimeout}).", ".
|
(time()+$session{setting}{sessionTimeout}).", ".time().", 0, '$ENV{REMOTE_ADDR}', $_[0])");
|
||||||
time().", 0, '$ENV{REMOTE_ADDR}', $_[0])",$session{dbh});
|
|
||||||
setCookie("wgSession",$sessionId);
|
setCookie("wgSession",$sessionId);
|
||||||
refreshSessionVars($sessionId);
|
refreshSessionVars($sessionId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue