Fixes
This commit is contained in:
parent
c9b5254f24
commit
08a46f5e00
5 changed files with 52 additions and 29 deletions
|
|
@ -44,9 +44,10 @@ if(uname && session) {
|
|||
session: session
|
||||
};
|
||||
postJSON(WEB_URL + "/api/login?callback=?", data, function (data) {
|
||||
console.log(data);
|
||||
if(data.success)
|
||||
onLogin();
|
||||
}, "jsonp");
|
||||
});
|
||||
}
|
||||
|
||||
function onLogin() {
|
||||
|
|
@ -182,7 +183,7 @@ $("#registerbtn").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#registerpane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
});
|
||||
|
||||
$("#loginbtn").click(function() {
|
||||
|
|
@ -217,7 +218,7 @@ $("#loginbtn").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#loginpane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
});
|
||||
|
||||
$("#cpwbtn").click(function() {
|
||||
|
|
@ -279,7 +280,7 @@ $("#cpwbtn").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#changepwpane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
});
|
||||
|
||||
$("#cebtn").click(function() {
|
||||
|
|
@ -332,7 +333,7 @@ $("#cebtn").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#changeemailpane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -360,7 +361,7 @@ $("#rpbtn").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#pwresetpane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -388,7 +389,7 @@ $("#profilesave").click(function() {
|
|||
.text(data.error)
|
||||
.insertBefore($("#profilepane form"));
|
||||
}
|
||||
}, "jsonp");
|
||||
});
|
||||
});
|
||||
|
||||
$("#login").click(function() {
|
||||
|
|
|
|||
|
|
@ -37,6 +37,30 @@
|
|||
<script src="assets/js/jquery.js" type="text/javascript"></script>
|
||||
<script src="assets/js/iourl.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
/*
|
||||
So, it turns out that $.post causes Firefox to use a GET request
|
||||
on cross-site requests. What the hell? I'd understand if they just
|
||||
made it error instead, but why give me chicken tenders if I ordered a
|
||||
cheeseburger and act like everything's peachy?
|
||||
*/
|
||||
function postJSON(url, data, callback) {
|
||||
$.ajax(url, {
|
||||
method: "POST",
|
||||
crossDomain: true,
|
||||
data: data,
|
||||
success: function (data) {
|
||||
try {
|
||||
data = data.substring(data.indexOf("{"));
|
||||
data = data.substring(0, data.lastIndexOf("}") + 1);
|
||||
data = JSON.parse(data);
|
||||
callback(data);
|
||||
} catch(e) {
|
||||
return;
|
||||
}
|
||||
},
|
||||
dataType: "text"
|
||||
});
|
||||
}
|
||||
function readCookie(name) {
|
||||
var nameEQ = name + "=";
|
||||
var ca = document.cookie.split(";");
|
||||
|
|
@ -70,10 +94,10 @@
|
|||
name: $("#username").val(),
|
||||
pw: $("#pw").val()
|
||||
};
|
||||
$.post(WEB_URL+"/api/login", data, function (data) {
|
||||
postJSON(WEB_URL+"/api/login", data, function (data) {
|
||||
data.uname = $("#username").val();
|
||||
source.postMessage("cytube-login:"+JSON.stringify(data), document.location);
|
||||
}, "jsonp");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue