예제 #1
0
    private void LoginRequest(int cnnId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        // Debug.Log(string.Format("{0},{1}",lr.UsernameOrEmail,lr.Password));

        string             randomToken = Utility.GenerateRandom(4); //Change to 256 on production
        Model_Account      account     = db.LoginAccount(lr.UsernameOrEmail, lr.Password, cnnId, randomToken);
        Net_OnLoginRequest olr         = new Net_OnLoginRequest();

        if (account != null)
        {
            olr.Success     = 1;
            olr.Information = "You have been logged in as" + account.Username;

            olr.Username      = account.Username;
            olr.Discriminator = account.Username;
            olr.Token         = account.Token;
            olr.ConnectionId  = cnnId;
        }
        else
        {
            olr.Success = 0;
        }


        SendClient(recHostId, cnnId, olr);
    }
예제 #2
0
    private void LoginRequest(int cnnId, int channelId, int recHostId, Net_LoginRequest lr)
    {
        // Debug.Log(string.Format("{0},{1}",lr.UsernameOrEmail,lr.Password));

        string             randomToken = Utility.GenerateRandom(4); //Change to 256 on production
        Model_Account      account     = db.LoginAccount(lr.UsernameOrEmail, lr.Password, cnnId, randomToken);
        Net_OnLoginRequest olr         = new Net_OnLoginRequest();

        if (account != null)
        {
            olr.Success     = 1;
            olr.Information = "You have been logged in as" + account.Username;

            olr.Username      = account.Username;
            olr.Discriminator = account.Discriminator;
            olr.Token         = account.Token;
            olr.ConnectionId  = cnnId;

            // Here

            // Prepare and send update message
            Net_UpdateFollow fu = new Net_UpdateFollow();
            fu.Follow = account.GetAccount();

            foreach (var f in db.FindAllFollowBy(account.Email))
            {
                if (f.ActiveConnection == 0)
                {
                    continue;
                }

                SendClient(recHostId, f.ActiveConnection, fu);
            }
        }
        else
        {
            olr.Success = 0;
        }


        SendClient(recHostId, cnnId, olr);
    }