Exemplo n.º 1
0
        // -------------------------------------------------------------------------------
        // ReqAccountForgotPassword
        // -------------------------------------------------------------------------------
        public void ReqAccountForgotPassword(string[] fields, Action <string[]> callbackFunction)
        {
            DictionaryAddAction(callbackFunction);

            clientAccount = new CAccount();

            clientAccount.sName = fields[0];

            MsgReqAccountForgotPassword message = new MsgReqAccountForgotPassword {
                sName = fields[0]
            };

            networkManager.client.Send(MsgReqAccountForgotPassword.nId, message);
        }
Exemplo n.º 2
0
        // -------------------------------------------------------------------------------
        // ReqAccountForgotPassword
        // -------------------------------------------------------------------------------
        public MsgAckAccountForgotPassword ReqAccountForgotPassword(MsgReqAccountForgotPassword message, NetworkConnection connection = null)
        {
            int      _nResult = confirmAccountForgotPassword ? Constants.INT_CONFIRM : Constants.INT_FAILURE;
            CAccount cAccount = null;

            if (!dictLobby.TryGetValue(connection, out cAccount))
            {
                cAccount = databaseManager.AccountLoad(message.sName);

                if (cAccount != null && !cAccount.IsEmpty)
                {
                    if (confirmAccountForgotPassword && !cAccount.IsDone)
                    {
                        RequestSecurityCode(cAccount, Constants.AccountActionType.ForgotPassword);
                    }
                    else
                    {
                        int tmpPassword = UnityEngine.Random.Range(1000, 9999);
                        cAccount.sPassword = passwordManager.CreateHash(Tools.HashPassword(tmpPassword.ToString()));
                        mailManager.SendMailForgotPassword(cAccount.sMail, tmpPassword);
                        _nResult = AccountUpdate(cAccount, connection) ? Constants.INT_SUCCESS : _nResult;
                    }
                }
                else
                {
                    _nResult = Constants.INT_FAILURE;
                }
            }
            else
            {
                _nResult = Constants.INT_FAILURE;
            }


            return(new MsgAckAccountForgotPassword {
                nResult = _nResult
            });
        }
Exemplo n.º 3
0
        // -------------------------------------------------------------------------------
        // OnReqAccountForgotPassword
        // -------------------------------------------------------------------------------
        public void OnReqAccountForgotPassword(NetworkMessage networkMessage)
        {
            MsgReqAccountForgotPassword message = networkMessage.ReadMessage <MsgReqAccountForgotPassword>();

            networkMessage.conn.Send(MsgAckAccountForgotPassword.nId, accountManager.ReqAccountForgotPassword(message, networkMessage.conn));
        }