Exemple #1
0
    protected override void Execute()
    {
        string ticket = web.Param("ticket");

        // get steam user id from auth ticket
        SteamApi api     = new SteamApi();
        string   SteamID = api.GetSteamId(ticket);

        if (SteamID.Length == 0)
        {
            Response.Write("WO_5");
            Response.Write(api.lastData_);
            return;
        }

        // try to login user based on his steamID
        SqlCommand sqcmd = new SqlCommand();

        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WO_SteamLogin";
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
        sqcmd.Parameters.AddWithValue("@in_SteamID", SteamID);

        if (!CallWOApi(sqcmd))
        {
            return;
        }

        reader.Read();
        int CustomerID    = getInt("CustomerID");;
        int AccountStatus = getInt("AccountStatus");
        int SessionID     = 0;
        int IsDeveloper   = 0;

        if (CustomerID > 0)
        {
            SessionID   = getInt("SessionID");
            IsDeveloper = getInt("IsDeveloper");
        }

        // region lock
        if (IsDeveloper == 0 && IPLocationCheck.IsRegionLocked(LastIP, CustomerID))
        {
            // special 600 code meaning we're IP locked.
            AccountStatus = 600;
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1} {2}",
                                     CustomerID, SessionID, AccountStatus));
        return;
    }
Exemple #2
0
    protected override void Execute()
    {
        string username = web.Param("username");
        string password = web.Param("password");

        SqlCommand sqcmd = new SqlCommand();

        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WO_LOGIN";
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);
        sqcmd.Parameters.AddWithValue("@in_Username", username);
        sqcmd.Parameters.AddWithValue("@in_Password", password);

        if (!CallWOApi(sqcmd))
        {
            return;
        }

        reader.Read();
        int CustomerID    = getInt("CustomerID");;
        int AccountStatus = getInt("AccountStatus");
        int SessionID     = 0;
        int IsDeveloper   = 0;

        if (CustomerID > 0)
        {
            SessionID   = getInt("SessionID");
            IsDeveloper = getInt("IsDeveloper");
        }

        // region lock
        if (IsDeveloper == 0 && IPLocationCheck.IsRegionLocked(LastIP, CustomerID))
        {
            // special 600 code meaning we're IP locked.
            AccountStatus = 600;
        }

        Response.Write("WO_0");
        Response.Write(string.Format("{0} {1} {2}",
                                     CustomerID, SessionID, AccountStatus));
    }
    void RegisterLoginIP(int CustomerID)
    {
        SqlCommand sqcmd = new SqlCommand();
        sqcmd.CommandType = CommandType.StoredProcedure;
        sqcmd.CommandText = "WZ_ACCOUNT_RegisterLoginIP";
        sqcmd.Parameters.AddWithValue("@in_CustomerID", CustomerID);
        sqcmd.Parameters.AddWithValue("@in_IP", LastIP);

        if (!CallWOApi(sqcmd))
            return;

        reader.Read();
        int IsNew = getInt("IsNew");
        string email = getString("email");
        if (IsNew == 0)
            return;

        // we have new ip, send email to devs about that
        string GeoCode = IPLocationCheck.GetCountryCode(LastIP);

        try
        {
            MailMessage mail = new MailMessage("*****@*****.**", "*****@*****.**");
            SmtpClient client = new SmtpClient();
            client.DeliveryMethod = SmtpDeliveryMethod.Network;
            client.Host = "smtp.mandrillapp.com";
            client.Port = 25;
            client.UseDefaultCredentials = false;
            client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "a216ff3e-8cee-431a-a111-3c151803ac5b");
            mail.Subject = "WarZ Developer Account Login IP detected";
            mail.Body = string.Format(
                "Developer Account {0} {1} was logged from IP {2}, country:{3}",
                CustomerID, email, LastIP, GeoCode);
            client.Send(mail);
        }
        catch (System.Exception ex)
        {
            throw new ApiExitException("can't send dev login email: " + ex.Message);
        }
    }