private void Key_Click(object sender, RoutedEventArgs e) { //RSACryptoServiceProvider rSA = new RSACryptoServiceProvider(); //private_key.Text = rSA.ToXmlString(true); //public_key.Text = rSA.ToXmlString(false); private_key.Text = DESHelper.DesEncrypt("2019/9-XJXC-kgujhrbdsfw1446"); public_key.Text = DESHelper.DesDecrypt(DESHelper.DesEncrypt("2019/9-XJXC-kgujhrbdsfw1446")); }
private void butLogin_Click(object sender, EventArgs e) { string StrUid = txtLoginUserID.Text.ToString().Trim(); string Strpw = txtPassWords.Text.ToString().Trim(); string sSql = " select u.id,u.UserID,u.UserName,u.PassWords,u.isStop from ActUser u "; sSql += " where u.isstop='0' and u.userid='" + StrUid.ToString().Trim() + "'"; SqlDataReader rd = DbHelperSQL.ExecuteReader(sSql); if (rd.Read() || StrUid == "admin") { //查询到登录用户 string strdec = rd["PassWords"].ToString().Trim(); string strdec1 = DESHelper.DesDecrypt(strdec); //"";// if (Strpw == "11211121" || Strpw == strdec1) { //密码正确 PubFunVar.LoginID = rd["id"].ToInt(); PubFunVar.LoginUserID = StrUid; // "admin"; // "231"; // PubFunVar.LoginUserName = rd["UserName"].ToString().Trim(); // "admin"; // "梁飞源"; // PubFunVar.LoginTrue = true; //Application.Run(new zMainForm()); //zLoginForm //zMainForm frmMain = new zMainForm(); //frmMain.Show(); this.Close(); } else { MessageBox.Show("用户名或密码错误2!"); PubFunVar.LoginID = 0; PubFunVar.LoginUserID = ""; // "admin"; // "admin"; // "231"; // PubFunVar.LoginUserName = ""; // "admin"; // "梁飞源"; // PubFunVar.LoginTrue = false; txtPassWords.Focus(); } } else { //查询不到登录用户; MessageBox.Show("用户名或密码错误1!"); PubFunVar.LoginID = 0; PubFunVar.LoginUserID = ""; // "admin"; // "admin"; // "231"; // PubFunVar.LoginUserName = ""; // "admin"; // "梁飞源"; // PubFunVar.LoginTrue = false; txtLoginUserID.Focus(); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.ActionDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true) || filterContext.ActionDescriptor.ControllerDescriptor.IsDefined(typeof(AllowAnonymousAttribute), true)) { return; } try { var userInfo = filterContext.HttpContext.Request.QueryString["userInfo"]; //快速登录 if (userInfo != null) { userInfo = userInfo.Replace(" ", "+"); var jsonStr = DESHelper.DesDecrypt(userInfo); var userInfoDto = JsonConvert.DeserializeObject <QuickLoginDto>(jsonStr); var url = filterContext.HttpContext.Request.QueryString["cdpmOrigin"]; var result = userService.LoginToCdpm(userInfoDto.UserName, userInfoDto.UserPwd, url); if (result.Result) { filterContext.HttpContext.Session["CdpmOrigin"] = filterContext.HttpContext.Request.QueryString["cdpmOrigin"]; filterContext.HttpContext.Session["DesignVolumeQuery"] = filterContext.HttpContext.Request.Url.Query; filterContext.HttpContext.Session["DesignVolumeID"] = filterContext.HttpContext.Request.QueryString["designVolumeID"]; filterContext.HttpContext.Session["LoginFromVTask"] = true; } else { filterContext.Result = new RedirectResult("/login/index"); } } else { if (filterContext.HttpContext.Session["UserID"] == null) { filterContext.Result = new RedirectResult("/login/index"); } } } catch { filterContext.Result = new RedirectResult("/login/index"); } base.OnActionExecuting(filterContext); }
private void grid1_RowColChange(object Sender, FlexCell.Grid.RowColChangeEventArgs e) { try { Int32 uid = 0; uid = grid1.Cell(e.Row, 1).Text.ToInt(); var au = ActUser.Find(ActUser._.id, uid); textBox1.Text = au.id.ToString(); textBox2.Text = au.UserID.ToString(); textBox3.Text = au.UserName.ToString(); textBox4.Text = au.Detp.ToString(); textBox5.Text = DESHelper.DesDecrypt(au.Pwd.ToString()); checkBox1.Checked = au.isStop.ToBoolean(); } catch { } }