/** * Modificar la clave de un usuario. * * @param $userId * @param $userPass * @return bool */ public static function updateUserPass($userId, $userPass) { $passdata = self::makeUserPassHash($userPass); $userLogin = UserUtil::getUserLoginById($userId); $query = 'UPDATE usrData SET ' . 'user_pass = :pass,' . 'user_hashSalt = :salt,' . 'user_isChangePass = 0,' . 'user_lastUpdate = NOW() ' . 'WHERE user_id = :id LIMIT 1'; $data['pass'] = $passdata['pass']; $data['salt'] = $passdata['salt']; $data['id'] = $userId; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } self::$queryLastId = DB::$lastId; Log::writeNewLogAndEmail(_('Modificar Clave Usuario'), sprintf('%s : %s', Html::strongText(_('Login')), $userLogin)); return true; }
/** * Eliminar un usuario. * * @return bool */ public function deleteUser() { $userLogin = UserUtil::getUserLoginById($this->_userId); $query = 'DELETE FROM usrData WHERE user_id = :id LIMIT 1'; $data['id'] = $this->_userId; if (DB::getQuery($query, __FUNCTION__, $data) === false) { return false; } $this->queryLastId = DB::$lastId; Log::writeNewLogAndEmail(_('Eliminar Usuario'), sprintf('%s: %s', Html::strongText(_('Login')), $userLogin)); return true; }