protected override ResultStatus CheckShield() { base.CheckShield(); string orgPassword = txtOrgPassword.Text; string password = txtPassword.Text; string confirmPassword = txtConfirmPassword.Text; if (orgPassword == password) { MessageDisplay.Warning("「原始舊密碼」與「變更後新密碼」相同"); txtPassword.Focus(); return(ResultStatus.Fail); } if (string.IsNullOrEmpty(confirmPassword)) { MessageDisplay.Warning("請輸入「再次確認新密碼」欄位"); txtConfirmPassword.Focus(); return(ResultStatus.Fail); } if (confirmPassword != password) { MessageDisplay.Warning("「變更後新密碼」與「再次確認新密碼」不符"); txtPassword.Focus(); return(ResultStatus.Fail); } if (password.Length < 8) { MessageDisplay.Warning("密碼長度必須大於8位!"); txtPassword.Focus(); return(ResultStatus.Fail); } Regex regx = new Regex(@"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$"); if (!regx.IsMatch(password)) { MessageDisplay.Warning("密碼不符規定,至少(大寫英文'A',小字英文'a',數字'1')型態各一!"); txtPassword.Focus(); return(ResultStatus.Fail); } DataTable dt = daoUPF.ListDataByUserIdAndPassword(lblUserId.Text, orgPassword); if (dt.Rows.Count == 0) { MessageDisplay.Warning("原密碼輸入錯誤"); txtOrgPassword.Focus(); return(ResultStatus.Fail); } return(ResultStatus.Success); }
public DataTable CheckUPFByPassword(string UPF_USER_ID, string UPF_PASSWORD) { return(daoUPF.ListDataByUserIdAndPassword(UPF_USER_ID, UPF_PASSWORD)); }