mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-15 00:15:08 +01:00
39 lines
980 B
JavaScript
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();
|
|
});
|
|
|
|
});
|