Implement Hello messages for changing name while connected

This commit is contained in:
Tissevert 2020-02-03 19:10:01 +01:00
parent a136cab1c8
commit 49df598d7d
2 changed files with 7 additions and 1 deletions

View file

@ -29,7 +29,11 @@ function initLogin() {
loginForm.join.value = I18n.get('join'); loginForm.join.value = I18n.get('join');
loginForm.addEventListener('submit', function(e) { loginForm.addEventListener('submit', function(e) {
e.preventDefault(); e.preventDefault();
Session.start(loginForm.you.value); if(!Session.isLoggedIn()) {
Session.start(loginForm.you.value);
} else {
Messaging.send({tag: 'Hello', name: loginForm.you.value});
}
}); });
loginForm.you.addEventListener("input", validate); loginForm.you.addEventListener("input", validate);
} }

View file

@ -17,6 +17,8 @@ Messaging.addEventListener(["LogIn"], function(o) {
} }
}); });
Messaging.addEventListener('close', function() {loggedIn = false;});
return { return {
is: is, is: is,
getKey: getKey, getKey: getKey,