MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / setupAuth

Method setupAuth

plugins/plugin_utils/plugin_HTTP.cpp:292–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290}
291
292void BZFSHTTPAuth::setupAuth(void) {
293 authPage = "<html><body><h4><a href=\"[$WebAuthURL]\">Please Login</a></h4></body></html>";
294
295 std::string returnURL;
296 if (!getBaseURL().size()) {
297 returnURL += format("http://localhost:%d/%s/", bz_getPublicPort(), getVDir());
298 }
299 else {
300 returnURL += getBaseURL();
301 }
302 returnURL += "?action=login&token=%TOKEN%&user=%USERNAME%";
303
304 tsCallback.URL = "http://my.bzflag.org/weblogin.php?action=weblogin&url=";
305 tsCallback.URL += url_encode(returnURL);
306
307 templateSystem.addKey("WebAuthURL", &tsCallback);
308}
309
310void BZFSHTTPAuth::TSURLCallback::keyCallback(std::string& data, const std::string& key) {
311 if (compare_nocase(key, "WebAuthURL") == 0) {

Callers

nothing calls this directly

Calls 6

bz_getPublicPortFunction · 0.85
getVDirFunction · 0.85
addKeyMethod · 0.80
formatFunction · 0.70
url_encodeFunction · 0.70
sizeMethod · 0.45

Tested by

no test coverage detected