implements #20

with #fd2ef569b36f98c00ee7e9953f0041d6dff30316 fixes #20
This commit is contained in:
Kevin Ramharak 2018-01-03 06:00:17 +01:00 committed by GitHub
parent fd2ef569b3
commit dae48c0ded
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -803,17 +803,17 @@ function codeListener(message) {
* Listens for authentications responses from the server
*/
function authListener(message) {
if (message.t === "auth") {
if (message.m === "ok") {
console.log("Auth successful");
mar.client.requestUserInfo();
} else {
alert("Authentication failed. Please make sure you are logged in and reload the page.");
if (message.t === "code") {
var code = message.code;
if(typeof window.localStorage !== 'undefined') { // localStorage is supported
var value = window.localStorage.getItem("editorCodeContents");
// if item does not exist null is returned
if(value !== null) {
code = value;
}
}
ace.edit("editor").setValue(code);
}
}