Difference between revisions of "NationStates:Login"

From NSWiki
Jump to: navigation, search
(typo)
m
Line 1: Line 1:
<shtml version="2" keyname="afforess" hash="c508dd732f7a30ea3c0bb80ff274622c29da6066da11c079a6159aa3c48c2214"><input id='nation_name' placeholder='Nation Name' type='text' style='width:350px;height:24px;'></input><button class='btn btn-primary' style='margin-left:5px;margin-top: -3px;' id='nation_enter'>Locate Nation</button>
+
<shtml version="2" keyname="afforess" hash="3c2a50ceab7d81d523f9845e929caeb8a6a7ae446adfab7a2189047def2c09ee"><input id='nation_name' placeholder='Nation Name' type='text' style='width:350px;height:24px;'></input><button class='btn btn-primary' style='margin-left:5px;margin-top: -3px;' id='nation_enter'>Locate Nation</button>
 
<p style='font-style: italic; font-size:15px; color:red;'>Ensure you are logged into the same NationStates nation you wish to login with to NSWiki! If not, go to NationStates.net and switch your nation.</p>
 
<p style='font-style: italic; font-size:15px; color:red;'>Ensure you are logged into the same NationStates nation you wish to login with to NSWiki! If not, go to NationStates.net and switch your nation.</p>
 
<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>
Line 65: Line 65:
 
console.log("Login Successful");
 
console.log("Login Successful");
 
console.log(data);
 
console.log(data);
window.location.href = "http://nswiki.org";
+
//window.location.href = "http://nswiki.org";
 
}).fail(function(jqXHR, textStatus, errorThrown) {
 
}).fail(function(jqXHR, textStatus, errorThrown) {
 
console.log(jqXHR.responseText);
 
console.log(jqXHR.responseText);
Line 72: Line 72:
 
$("#login_status").hide();
 
$("#login_status").hide();
 
});
 
});
})
+
});
 +
setTimeout(function() {
 +
$.get("http://nswiki.org/index.php?title=Special:UserLogin", function(data) {
 +
var token = $(data).find("input[name='wpLoginToken']").val();
 +
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=" + password + ampersand + "wpRemember=1" + ampersand + "wpLoginAttempt=Log+in" + ampersand + "wpLoginToken=" + token, function(data) {
 +
console.log("Login Successful");
 +
console.log(data);
 +
window.location.href = "http://nswiki.org";
 +
}).fail(function(jqXHR, textStatus, errorThrown) {
 +
console.log(jqXHR.responseText);
 +
$("#login_error").html("Login Failed. Try again or report the error to an administrator.").show();
 +
$("#nation_verify").removeAttr("disabled");
 +
$("#login_status").hide();
 +
});
 +
});
 +
}, 1000);
 
}).fail(function(jqXHR, textStatus, errorThrown) {
 
}).fail(function(jqXHR, textStatus, errorThrown) {
 
$("#login_error").html(jqXHR.responseText).show();
 
$("#login_error").html(jqXHR.responseText).show();

Revision as of 00:22, 7 April 2014

Ensure you are logged into the same NationStates nation you wish to login with to NSWiki! If not, go to NationStates.net and switch your nation.