コード例 #1
0
    protected void btnOk_Click(object sender, EventArgs e)
    {
        ParamFacade facade = new ParamFacade();
        ParamInfo param = facade.GetParam("AdministratorPassword");
        string oldPassword = EncryptTool.MD5(txtOldPassword.Text);
        string newPassword = EncryptTool.MD5(txtNewPassword.Text);
        string confirmPassword = EncryptTool.MD5(txtConfirmPassword.Text);
        if (newPassword != confirmPassword)
        {
            lblMessage.Text = "两次输入的密码不相同。";
            return;
        }
        if (param == null || string.IsNullOrEmpty(param.Value) || param.Value == oldPassword)
        {
            param = new ParamInfo();
            param.Key = "AdministratorPassword";
            param.Value = newPassword;
            facade.SaveParam(param);

            string url = "Default.aspx";
            if (!string.IsNullOrEmpty(Request["ReturnUrl"]))
            {
                url = Request["ReturnUrl"];
            }
            string msg = "修改密码成功!";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertChangePassword", "AlertAndRedirect('" + msg + "', '" + url + "');", true);
        }
        else
        {
            lblMessage.Text = "旧密码输入不正确。";
            return;
        }
    }
コード例 #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ParamFacade facade = new ParamFacade();
         ParamInfo param = facade.GetParam("AdministratorPassword");
         if (param == null || string.IsNullOrEmpty(param.Value))
         {
             txtOldPassword.Enabled = false;
             lblMessage.Text = "管理员密码尚未设置,请直接输入新密码。";
         }
     }
 }
コード例 #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         ParamFacade facade = new ParamFacade();
         ParamInfo param = facade.GetParam("AdministratorPassword");
         if (param == null || string.IsNullOrEmpty(param.Value))
         {
             string msg = "管理员密码尚未设置,请先设置管理员密码。";
             string url = this.ResolveUrl("AdminChangePassword.aspx?ReturnUrl=AdminLogin.aspx");
             JavascriptAlertAndRedirect(msg, url);
         }
     }
 }
コード例 #4
0
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     string password = EncryptTool.MD5(txtPassword.Text);
     ParamFacade facade = new ParamFacade();
     ParamInfo param = facade.GetParam("AdministratorPassword");
     if (param != null && param.Value == password)
     {
         IsAdminLogined = true;
         string url = "Default.aspx";
         if (!string.IsNullOrEmpty(Request["ReturnUrl"]))
         {
             url = Request["ReturnUrl"];
         }
         RedirectToUrl(url);
     }
     else
     {
         lblMessage.Text = "密码错误!";
     }
 }