Send sigil/id code/persistent id when reconnecting.

First load handler needs to send those things so the client actually has it. Doesn't really need the persistent id there, but it definitely needs the sigil to avoid undefined errors.
This commit is contained in:
Andy Janata 2018-03-27 11:05:01 -07:00
parent 988f63887b
commit 28e040aaec
2 changed files with 9 additions and 2 deletions

View File

@ -27,7 +27,7 @@
* @author Andy Janata (ajanata@socialgamer.net)
*/
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.REGISTER] = function(data) {
cah.ajax.StoreClientInformation_ = function(data) {
cah.nickname = data[cah.$.AjaxResponse.NICKNAME];
cah.idcode = data[cah.$.AjaxResponse.ID_CODE];
cah.sigil = data[cah.$.AjaxResponse.SIGIL];
@ -35,6 +35,10 @@ cah.ajax.SuccessHandlers[cah.$.AjaxOperation.REGISTER] = function(data) {
cah.persistentId = data[cah.$.AjaxResponse.PERSISTENT_ID];
cah.setCookie("persistent_id", cah.persistentId);
}
};
cah.ajax.SuccessHandlers[cah.$.AjaxOperation.REGISTER] = function(data) {
cah.ajax.StoreClientInformation_(data);
cah.log.status("You are connected as " + cah.sigil + cah.nickname);
$("#welcome").hide();
$("#canvass").show();
@ -53,7 +57,7 @@ cah.ajax.SuccessHandlers[cah.$.AjaxOperation.FIRST_LOAD] = function(data) {
cah.CardSet.populateCardSets(data[cah.$.AjaxResponse.CARD_SETS]);
if (data[cah.$.AjaxResponse.IN_PROGRESS]) {
cah.nickname = data[cah.$.AjaxResponse.NICKNAME];
cah.ajax.StoreClientInformation_(data);
cah.log.status("You have reconnected as " + cah.nickname);
$("#welcome").hide();
$("#canvass").show();

View File

@ -100,6 +100,9 @@ public class FirstLoadHandler extends Handler {
// and tell the client where to continue from.
ret.put(AjaxResponse.IN_PROGRESS, Boolean.TRUE);
ret.put(AjaxResponse.NICKNAME, user.getNickname());
ret.put(AjaxResponse.PERSISTENT_ID, user.getPersistentId());
ret.put(AjaxResponse.ID_CODE, user.getIdCode());
ret.put(AjaxResponse.SIGIL, user.getSigil().toString());
if (user.getGame() != null) {
ret.put(AjaxResponse.NEXT, ReconnectNextAction.GAME.toString());