mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-09-09 20:38:45 -05:00
Add support for omitting userid for getassertion
This commit is contained in:
@@ -155,13 +155,14 @@ foreach ($reqs as $reqData) {
|
||||
case 'getassertion':
|
||||
// direct
|
||||
$servertoken = getServerToken($users->getCookiePath());
|
||||
if (!$servertoken || empty($reqData['userid'])) {
|
||||
if (!$servertoken) {
|
||||
die('Bogus request.');
|
||||
}
|
||||
$challengekeyid = !isset($reqData['challengekeyid']) ? -1 : intval($reqData['challengekeyid']);
|
||||
$challenge = !isset($reqData['challenge']) ? '' : $reqData['challenge'];
|
||||
header('Content-type: text/plain');
|
||||
$userid = $users->userid($reqData['userid']);
|
||||
if (empty($reqData['userid'])) $userid = $curuser['userid'];
|
||||
else $userid = $users->userid($reqData['userid']);
|
||||
$servertoken = htmlspecialchars($servertoken); // Protect against theoretical IE6 XSS
|
||||
die($users->getAssertion($userid, $servertoken, null, $challengekeyid, $challenge));
|
||||
break;
|
||||
|
||||
@@ -2892,7 +2892,7 @@ function overlay(overlayType, data) {
|
||||
case 'testclientgetassertion':
|
||||
contents += '<p>Because of the <a href="https://en.wikipedia.org/wiki/Same-origin_policy" target="_blank">same-origin policy</a>, some manual work is required to log in using <code>testclient.html</code>.</p>';
|
||||
contents += '<iframe src="' + data.query + '" style="width: 100%; height: 50px;" class="textbox"></iframe>';
|
||||
contents += '<p>Please copy <strong>all the text</strong> from the box above and paste it in the box below. If the box above just shows a semi-colon (;) or says "Bogus request", log in using the <a href="http://play.pokemonshowdown.com" target="_blank">official client</a> and then refresh this page.</p>';
|
||||
contents += '<p>Please copy <strong>all the text</strong> from the box above and paste it in the box below. If the box above just shows a semi-colon (;), log in using the <a href="http://play.pokemonshowdown.com" target="_blank">official client</a> and then refresh this page.</p>';
|
||||
contents += '<input class="textbox" type="hidden" id="overlay_username" value="' + data.name + '" />';
|
||||
contents += '<p><label class="label">Data from the box above:</label> <input style="width: 100%;" class="textbox" type="text" id="overlay_assertion" /></p>';
|
||||
contents += '<p><button type="submit"><strong>Log in</strong></button> <button onclick="overlayClose();return false">Cancel</button></p>';
|
||||
@@ -3242,11 +3242,7 @@ var cookieTeams = true;
|
||||
if (parts[1] === 'challenge-string') {
|
||||
me.challengekeyid = parseInt(parts[2], 10);
|
||||
me.challenge = parts[3];
|
||||
if (name !== '') {
|
||||
renameMe(name);
|
||||
} else {
|
||||
overlay('rename');
|
||||
}
|
||||
renameMe(name);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user