Difference between revisions of "NationStates:Login"
From NSWiki
m (handle spaces) |
(fix token) |
||
Line 1: | Line 1: | ||
− | <shtml version="2" keyname="afforess" hash=" | + | <shtml version="2" keyname="afforess" hash="9518492f6b5700a995bbd863c4f8a8d7675858a8f0bda0146fde102787f9663c"><input id='nation_name' placeholder='Nation Name' type='text' style='width:350px;height:24px;'></input><button class='btn' style='margin-left:5px;margin-top: -3px;' id='nation_enter'>Locate Nation</button> |
<p id='login_error' style='color:red; font-weight:bold; display:none;'>An Error Occured</p> | <p id='login_error' style='color:red; font-weight:bold; display:none;'>An Error Occured</p> | ||
<div id='advanced' style='display:none; float:left;'> | <div id='advanced' style='display:none; float:left;'> | ||
<input id='nation_verify_login' placeholder='Your Login Verification Code' type='text' style='width:450px;height:24px;'></input> | <input id='nation_verify_login' placeholder='Your Login Verification Code' type='text' style='width:450px;height:24px;'></input> | ||
− | <button class=' | + | <button class='btn' style='margin-left:5px;margin-top: -3px;' id='nation_verify'>Verify Nation</button> |
<iframe frameborder="0" style='float: left; height:450px; width:750px;' data-src='http://embed.nationstates.net/page=verify_login'></iframe> | <iframe frameborder="0" style='float: left; height:450px; width:750px;' data-src='http://embed.nationstates.net/page=verify_login'></iframe> | ||
</div> | </div> | ||
Line 18: | Line 18: | ||
console.log("found nation named " + $("#nation_name").val()); | console.log("found nation named " + $("#nation_name").val()); | ||
$("#nation_enter").removeAttr("disabled").hide(); | $("#nation_enter").removeAttr("disabled").hide(); | ||
+ | $("#nation_name").val(data[$("#nation_name").val()]); | ||
$("#nation_name").hide() | $("#nation_name").hide() | ||
$("#advanced").show(); | $("#advanced").show(); | ||
Line 35: | Line 36: | ||
console.log("Accepted login"); | console.log("Accepted login"); | ||
$.get("http://nswiki.org/index.php?title=Special:UserLogin", function(data) { | $.get("http://nswiki.org/index.php?title=Special:UserLogin", function(data) { | ||
− | var token = $("input[name='wpLoginToken']").val(); | + | var token = $(data).find("input[name='wpLoginToken']").val(); |
console.log("Lokin token: " + token); | console.log("Lokin token: " + token); | ||
− | $.post("http://nswiki.org/index.php?title=Special:UserLogin" + ampersand + "action=submitlogin" + ampersand + "type=login", "wpName=" + $("#nation_name").val().split(" ").join("+") + ampersand + "wpPassword=" + $("#nation_name").attr("password") + ampersand + "wpRemember=1" + ampersand + "wpLoginAttempt=Log+in" + ampersand + "wpLoginToken= | + | $.post("http://nswiki.org/index.php?title=Special:UserLogin" + ampersand + "action=submitlogin" + ampersand + "type=login", "wpName=" + $("#nation_name").val().split(" ").join("+") + ampersand + "wpPassword=" + $("#nation_name").attr("password") + ampersand + "wpRemember=1" + ampersand + "wpLoginAttempt=Log+in" + ampersand + "wpLoginToken=" + token, function(data) { |
console.log("Login Successful"); | console.log("Login Successful"); | ||
console.log(data); | console.log(data); |
Revision as of 21:11, 22 January 2014