/** * update the password. * update the password in the shard + update the password in the www/CMS version. * @param $user the username * @param $pass the new password. * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. */ public static function setPassword($user, $pass) { $hashpass = crypt($pass, WebUsers::generateSALT()); $reply = WebUsers::setAmsPassword($user, $hashpass); $drupal_pass = user_hash_password($pass); $values = array('user' => $user, 'pass' => $drupal_pass); try { //make connection with and put into shard db db_query("UPDATE {users} SET pass = :pass WHERE name = :user", $values); } catch (PDOException $e) { //ERROR: the web DB is offline } return $reply; }
/** * update the password. * update the password in the shard + update the password in the www/CMS version. * @param $user the username * @param $pass the new password. * @return ok if it worked, if the lib or shard is offline it will return liboffline or shardoffline. */ public static function setPassword($user, $pass) { $hashpass = crypt($pass, WebUsers::generateSALT()); $reply = WebUsers::setAmsPassword($user, $hashpass); $values = array('Password' => $hashpass); try { //make connection with and put into shard db $dbw = new DBLayer("web"); $dbw->update("ams_user", $values, "Login = '******'"); } catch (PDOException $e) { //ERROR: the web DB is offline } return $reply; }