pass reset function
This commit is contained in:
@@ -2387,20 +2387,27 @@ class Databap extends PhpObject
|
||||
return $this->getJsonPostResult($bSuccess, $sDesc);
|
||||
}
|
||||
|
||||
/*public function resetAllPass()
|
||||
public function resetPass($iUserId)
|
||||
{
|
||||
$asInfo = array('select'=>array(MySqlManager::getId(self::USER_TABLE, true), MySqlManager::getText(self::COMP_TABLE)),
|
||||
'from'=> self::USER_TABLE,
|
||||
'join'=> array(self::COMP_TABLE=>MySqlManager::getId(self::COMP_TABLE)));
|
||||
$asUsers = $this->oMySql->selectRows($asInfo);
|
||||
foreach($asUsers as $asUser)
|
||||
if($iUserId>0)
|
||||
{
|
||||
$sToken = $this->oAuth->HashPassword(self::getLoginToken($asUser[MySqlManager::getText(self::COMP_TABLE)]));
|
||||
$iUserId = $asUser[MySqlManager::getId(self::USER_TABLE)];
|
||||
$this->oMySql->updateRow(self::USER_TABLE, $iUserId, array('pass'=>$sToken));
|
||||
$sUserIdCol = MySqlManager::getId(self::USER_TABLE, true);
|
||||
$asInfo = array('select'=>array($sUserIdCol, MySqlManager::getText(self::COMP_TABLE)),
|
||||
'from'=> self::USER_TABLE,
|
||||
'join'=> array(self::COMP_TABLE=>MySqlManager::getId(self::COMP_TABLE)),
|
||||
'constraint'=>array($sUserIdCol=>$iUserId));
|
||||
$asUsers = $this->oMySql->selectRows($asInfo);
|
||||
foreach($asUsers as $asUser)
|
||||
{
|
||||
$sToken = $this->oAuth->HashPassword(self::getLoginToken($asUser[MySqlManager::getText(self::COMP_TABLE)]));
|
||||
$iUserId = $asUser[MySqlManager::getId(self::USER_TABLE)];
|
||||
$this->oMySql->updateRow(self::USER_TABLE, $iUserId, array('pass'=>$sToken));
|
||||
}
|
||||
}
|
||||
else return 'KO';
|
||||
|
||||
return 'OK';
|
||||
}*/
|
||||
}
|
||||
|
||||
private function getExternalAccessPass($iUserId)
|
||||
{
|
||||
|
||||
@@ -189,6 +189,9 @@ if($bUserOk && $sAction!=Databap::EXT_ACCESS)
|
||||
$asInfo = explode('-', strtolower($oUser));
|
||||
$sResult = 'User added. Id='.$oDatabap->addUser($asInfo[0], $asInfo[1], $asInfo[2], array_key_exists(3, $asInfo)?$asInfo[3]:'');
|
||||
break;
|
||||
case 'reset_pass':
|
||||
$sResult = $oDatabap->resetPass($oUser);
|
||||
break;
|
||||
case 'build_index':
|
||||
$oDatabap->buildCompleteIndex();
|
||||
$sResult = 'Index ok';
|
||||
|
||||
Reference in New Issue
Block a user