protected void btnResetPassword_Click(object sender, System.EventArgs e) { Johnny.CMS.BLL.Access.Administrator bll = new Johnny.CMS.BLL.Access.Administrator(); Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator(); model.AdminId = Convert.ToInt32(Request.QueryString["id"]); model.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword, "MD5"); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); bll.ResetPassword(model); SetMessage(GetMessage("E00119", Johnny.CMS.WebUI.utility.ConfigInfo.DefaultPassword)); }
protected void btnSave_Click(object sender, EventArgs e) { //check input if (DataValidation.IsEmpty(txtOriginalPassword.Text)) { SetMessage(GetMessage("E00113")); txtOriginalPassword.Focus(); return; } if (DataValidation.IsEmpty(txtNewPassword.Text)) { SetMessage(GetMessage("E00114")); txtNewPassword.Focus(); return; } if (DataValidation.IsEmpty(txtConfirmedPassword.Text)) { SetMessage(GetMessage("E00115")); txtConfirmedPassword.Focus(); return; } if (!DataValidation.IsEqual(txtNewPassword.Text, txtConfirmedPassword.Text)) { SetMessage(GetMessage("E00116")); txtNewPassword.Focus(); return; } Johnny.CMS.BLL.Access.Administrator admin = new Johnny.CMS.BLL.Access.Administrator(); string strPwd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtOriginalPassword.Text, "MD5"); //check old password if (!admin.CheckLogin(DataConvert.GetString(Session["UserName"]), strPwd)) { SetMessage(GetMessage("E00117")); txtOriginalPassword.Focus(); return; } Johnny.CMS.OM.Access.Administrator model = new Johnny.CMS.OM.Access.Administrator(); model.AdminId = DataConvert.GetInt32(Session["UserId"]); model.Password = FormsAuthentication.HashPasswordForStoringInConfigFile(txtNewPassword.Text, "MD5"); model.UpdatedTime = System.DateTime.Now; model.UpdatedById = DataConvert.GetInt32(Session["UserId"]); model.UpdatedByName = DataConvert.GetString(Session["UserName"]); admin.ResetPassword(model); SetMessage(GetMessage("E00118")); }