Fix post-sync login

This commit is contained in:
2019-10-05 17:18:28 +02:00
parent 4e1738a427
commit 9a77c20cc6
4 changed files with 19 additions and 11 deletions

View File

@@ -157,7 +157,7 @@ class Auth extends PhpObject
return ($this->sApiKey!='' && $sApiKey==$this->sApiKey);
}
private function resetPass($iUserId=0)
public function resetPass($iUserId=0)
{
$sUserIdCol = Db::getId(self::USER_TABLE);
$sUserTextCol = Db::getText(self::USER_TABLE);
@@ -168,7 +168,7 @@ class Auth extends PhpObject
$asUsers = $this->oDb->selectRows($asInfo);
foreach($asUsers as $asUser)
{
$sToken = self::hashPassword(self::getLoginToken($asUser[$sUserTextCol]));
$sToken = self::hashPassword(self::getLoginToken('123456'));
$this->oDb->updateRow(self::USER_TABLE, array(Db::getId(self::USER_TABLE)=>$asUser[$sUserIdCol]), array('pass'=>$sToken));
}
}
@@ -179,8 +179,7 @@ class Auth extends PhpObject
$sServerName = array_key_exists('SERVER_NAME', $_SERVER)?$_SERVER['SERVER_NAME']:$_SERVER['PWD'];
$sAppPath = $_SERVER['REQUEST_SCHEME'].'://'.str_replace(array('http://', 'https://'), '', $sServerName.dirname($_SERVER['SCRIPT_NAME']));
$_GET['serv_name'] = $sAppPath.(mb_substr($sAppPath, -1)!='/'?'/':'');
//return md5($sPass.$_GET['serv_name']);
return md5($sPass.'http://localhost/catc/');
return md5($sPass.$_GET['serv_name']);
}
private function resetAuthCookie($iUserId)

View File

@@ -236,8 +236,13 @@ class CATC extends Main
$bSuccess = ($sDesc=='');
unlink($sBackupPath);
//Check for missing files
$asMissingFiles = (new Doc($this->oDb))->getMissingFiles();
if($bSuccess) {
//Reset passwords
$this->oAuth->resetPass();
//Check for missing files
$asMissingFiles = (new Doc($this->oDb))->getMissingFiles();
}
//Send list of missing files back
return self::getJsonResult($bSuccess, $sDesc, array('files'=>$asMissingFiles));