| 186 | } |
| 187 | |
| 188 | bool NetworkService::logout() |
| 189 | { |
| 190 | log(Priority::Important, "network: logout"); |
| 191 | bool result = true; |
| 192 | |
| 193 | if (_loggedInUserName && _password) { |
| 194 | httplib::SSLClient client(_serverAddress); |
| 195 | configureClient(client); |
| 196 | |
| 197 | httplib::Params params; |
| 198 | params.emplace("userName", *_loggedInUserName); |
| 199 | params.emplace("password", *_password); |
| 200 | |
| 201 | try { |
| 202 | result = executeRequest([&] { return client.Post("/alien-server/logout.php", params); }); |
| 203 | } catch (...) { |
| 204 | logNetworkError(); |
| 205 | result = false; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | _loggedInUserName = std::nullopt; |
| 210 | _password = std::nullopt; |
| 211 | return result; |
| 212 | } |
| 213 | |
| 214 | void NetworkService::refreshLogin() |
| 215 | { |
no test coverage detected