Files
Erupe/www/erupe/js/login.js
Andrew Gutekanst 501cfc2267 Add multi-region launcher support
Add custom launcher as well as support for both the original TW and JP
launchers.
2019-12-30 07:38:48 +09:00

39 lines
980 B
JavaScript

function createErrorAlert(message) {
parent.postMessage(message, "*");
}
// Function to continually check if we got a login result yet,
// then navigating to the character selection if we did.
function checkAuthResult() {
var loginResult = window.external.getLastAuthResult();
console.log('|' + loginResult + '|');
if(loginResult == "AUTH_PROGRESS") {
setTimeout(checkAuthResult, 1500);
} else if (loginResult == "AUTH_SUCCESS") {
window.location.href = 'charsel.html'
} else {
createErrorAlert("Error logging in!");
}
}
$(function() {
// Login form submission.
$("#loginform").submit(function(e){
e.preventDefault();
username = $("#username").val();
password = $("#password").val();
try{
window.external.loginCog(username, password, password);
} catch(e){
createErrorAlert("Error on loginCog: " + e);
}
checkAuthResult();
});
});