Log in when subscribing an existing email
This commit is contained in:
18
inc/user.php
18
inc/user.php
@@ -38,16 +38,23 @@ class User extends PhpObject {
|
||||
//Check Email availability
|
||||
$iUserId = $this->oDb->selectValue(self::USER_TABLE, Db::getId(self::USER_TABLE), array('email'=>$sEmail, 'active'=>'1'));
|
||||
|
||||
if($iUserId > 0) $sDesc = 'lang:nl_email_exists';
|
||||
if($iUserId > 0) {
|
||||
//Log user in
|
||||
$sDesc = 'lang:nl_email_exists';
|
||||
$bSuccess = true;
|
||||
}
|
||||
else {
|
||||
//Add/Reactivate user
|
||||
$iUserId = $this->oDb->insertUpdateRow(self::USER_TABLE, array('email'=>$sEmail, 'language'=>$sLang, 'active'=>'1'), array('email'));
|
||||
if($iUserId==0) $sDesc = 'lang:error_commit_db';
|
||||
else $bSuccess = true;
|
||||
else {
|
||||
$sDesc = 'lang:nl_subscribed';
|
||||
$bSuccess = true;
|
||||
}
|
||||
}
|
||||
|
||||
//Set Cookie (valid 1 year)
|
||||
if($iUserId > 0) {
|
||||
if($bSuccess) {
|
||||
$this->setUserId($iUserId);
|
||||
$this->updateCookie();
|
||||
}
|
||||
@@ -62,7 +69,10 @@ class User extends PhpObject {
|
||||
if($this->iUserId > 0) {
|
||||
$iUserId = $this->oDb->updateRow(self::USER_TABLE, $this->iUserId, array('active'=>'0'));
|
||||
if($iUserId==0) $sDesc = 'lang:error_commit_db';
|
||||
else $bSuccess = true;
|
||||
else {
|
||||
$sDesc = 'lang:nl_unsubscribed';
|
||||
$bSuccess = true;
|
||||
}
|
||||
}
|
||||
else $sDesc = 'lang:nl_unknown_email';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user