Difference between revisions of "NationStates:Login"

From NSWiki
Jump to: navigation, search
m (lowercase)
m (more changes)
Line 1: Line 1:
<shtml version="2" keyname="afforess" hash="023ee342b4ec1700d86a7268f252e8bf51c58a901b0eb19e5f3f8960f8707165"><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>
+
<shtml version="2" keyname="afforess" hash="a7d8365e19a0052528c1f1abefc25793549824cc5ed565384a2e346f353faccb"><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>
  
Line 9: Line 9:
 
<script type="text/javascript">
 
<script type="text/javascript">
 
$(document).ready(function() {
 
$(document).ready(function() {
 +
    var ampersand = "&"[0];
 +
console.log(ampersand);
 
$("#nation_enter").on("click", function(event) {
 
$("#nation_enter").on("click", function(event) {
 
event.preventDefault();
 
event.preventDefault();
Line 30: Line 32:
 
var password = Date.now() + $("#nation_name").val().toLowerCase().split(" ").join("");
 
var password = Date.now() + $("#nation_name").val().toLowerCase().split(" ").join("");
 
$("#nation_name").attr("password", password);
 
$("#nation_name").attr("password", password);
$.post("/nsapi/nswiki/login/", "nation=" + $("#nation_name").val().toLowerCase().split(" ").join("_") + "&auth=" + encodeURIComponent($("#nation_verify_login").val().trim()) + "&password=" + password, function(data) {
+
$.post("/nsapi/nswiki/login/", "nation=" + $("#nation_name").val().toLowerCase().split(" ").join("_") + ampersand + "auth=" + encodeURIComponent($("#nation_verify_login").val().trim()) + ampersand + "password=" + password, function(data) {
 
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 = $("input[name='wpLoginToken']").val();
 
console.log("Lokin token: " + token);
 
console.log("Lokin token: " + token);
$.post("http://nswiki.org/index.php?title=Special:UserLogin&action=submitlogin&type=login", "wpName=" + encodeURIComponent($("#nation_name").val()) + "&wpPassword=" + $("#nation_name").attr("password") + "&wpRemember=1&wpLoginAttempt=Log+in&wpLoginToken=b41707a7bcb6c93ec75bb44cc30c5187", function(data) {
+
$.post("http://nswiki.org/index.php?title=Special:UserLogin&action=submitlogin&type=login", "wpName=" + encodeURIComponent($("#nation_name").val()) + ampersand + "wpPassword=" + $("#nation_name").attr("password") + ampersand + "wpRemember=1" + ampersand + "wpLoginAttempt=Log+in" + ampersand + "wpLoginToken=b41707a7bcb6c93ec75bb44cc30c5187", function(data) {
 
console.log("Login Successful");
 
console.log("Login Successful");
 
console.log(data);
 
console.log(data);

Revision as of 20:39, 22 January 2014