Пример #1
0
    public int LoginSubmit(Page page, Sites site, string ID, string Password, string InputCheckCode, Shove.Web.UI.ShoveCheckCode sccCheckCode, ref string ReturnDescription)
    {
        ReturnDescription = "";

        bool Opt_isUseCheckCode = site.SiteOptions["Opt_isUseCheckCode"].ToBoolean(true);

        ID = ID.Trim();
        Password = Password.Trim();

        if ((ID == "") || (Password == ""))
        {
            ReturnDescription = "用户名和密码都不能为空";

            return -1;
        }

        if ((Opt_isUseCheckCode) && (!sccCheckCode.Valid(InputCheckCode)))
        {
            ReturnDescription = "验证码输入错误";

            return -2;
        }

        System.Threading.Thread.Sleep(500);

        ElectronTicketAgents electronTicketAgents = new ElectronTicketAgents();
        electronTicketAgents.ID = Shove._Convert.StrToInt(ID, 0);
        electronTicketAgents.Password = Password;

        return electronTicketAgents.Login(ref ReturnDescription);
    }
Пример #2
0
    /// <summary>
    /// 登录,用于页面普通 PostBack 情况
    /// </summary>
    /// <param name="page"></param>
    /// <param name="site"></param>
    /// <param name="Name"></param>
    /// <param name="Password"></param>
    /// <param name="InputCheckCode">用户输入的验证码</param>
    /// <param name="sccCheckCode">页面上的验证码控件</param>
    /// <param name="ReturnDescription"></param>
    /// <returns></returns>
    public int LoginSubmit(Page page, Sites site, string Name, string Password, string InputCheckCode, Shove.Web.UI.ShoveCheckCode sccCheckCode, ref string ReturnDescription)
    {
        ReturnDescription = "";

        bool Opt_isUseCheckCode = site.SiteOptions["Opt_isUseCheckCode"].ToBoolean(true);

        Name = Name.Trim();
        Password = Password.Trim();

        if ((Name == "") || (Password == ""))
        {
            ReturnDescription = "用户名和密码都不能为空";

            return -1;
        }

        if (Opt_isUseCheckCode)
        {
            if (sccCheckCode == null)
            {
                ReturnDescription = "验证码内部错误";

                return -2;
            }
            else
            {
                if (!sccCheckCode.Valid(InputCheckCode))
                {
                    ReturnDescription = "验证码输入错误";

                    return -3;
                }
            }
        }

        System.Threading.Thread.Sleep(500);

        Users user = new Users(site.ID);
        user.Name = Name;
        user.Password = Password;

        return user.Login(ref ReturnDescription);
    }