// ------------------------------------------------------------------------------- // ReqAccountLogin // ------------------------------------------------------------------------------- public MsgAckAccountLogin ReqAccountLogin(MsgReqAccountLogin message, NetworkConnection connection = null) { int _nResult = confirmAccountCreate || confirmAccountLogin ? Constants.INT_CONFIRM : Constants.INT_FAILURE; int _nActorsRemaining = actorsPerAccounts; CAccount cAccount = null; if (!AccountOnline(connection)) { cAccount = databaseManager.AccountLoad(message.sName); if (cAccount != null && cAccount.IsValid && passwordManager.VerifyPassword(message.sPassword, cAccount.sPassword)) { if (cAccount.bConfirmed || !confirmAccountCreate) { if (confirmAccountLogin && !cAccount.IsDone && !String.IsNullOrWhiteSpace(cAccount.sMail) && message.sDeviceId != cAccount.sDeviceId) { RequestSecurityCode(cAccount, Constants.AccountActionType.LoginAccount); _nResult = Constants.INT_RECONFIRM; } else { dictLobby.Add(connection, cAccount); _nActorsRemaining = AccountActorsRemaining(message.sName); _nResult = Constants.INT_SUCCESS; } } return(new MsgAckAccountLogin { nResult = _nResult, nActorsRemaining = _nActorsRemaining, sName = cAccount.sName, sMail = cAccount.sMail, bBanned = cAccount.bBanned, bDeleted = cAccount.bDeleted, bConfirmed = cAccount.bConfirmed }); } else { _nResult = Constants.INT_FAILURE; } } return(new MsgAckAccountLogin { nResult = _nResult }); }
// ------------------------------------------------------------------------------- // ReqAccountLogin // ------------------------------------------------------------------------------- public void ReqAccountLogin(string[] fields, Action <string[]> callbackFunction) { DictionaryAddAction(callbackFunction); clientAccount = new CAccount(); clientAccount.sName = fields[0]; MsgReqAccountLogin message = new MsgReqAccountLogin { sName = fields[0], sPassword = Tools.HashPassword(fields[1]), sDeviceId = fields[2] }; networkManager.client.Send(MsgReqAccountLogin.nId, message); }
// ------------------------------------------------------------------------------- // OnReqAccountLogin // ------------------------------------------------------------------------------- public void OnReqAccountLogin(NetworkMessage networkMessage) { MsgReqAccountLogin message = networkMessage.ReadMessage <MsgReqAccountLogin>(); networkMessage.conn.Send(MsgAckAccountLogin.nId, accountManager.ReqAccountLogin(message, networkMessage.conn)); }