/// <summary> /// 获取数据库连接连接配置 /// </summary> /// <param name="masterDb">是否访问主库,默认为是,否则访问从库即只读数据库</param> /// <returns></returns> public static DbConnectionOptions GeDbConnectionOptions(bool masterDb = true) { bool conStringEncrypt = Configs.GetConfigurationValue("AppSetting", "ConStringEncrypt").ToBool(); if (string.IsNullOrEmpty(dbConfigName)) { dbConfigName = Configs.GetConfigurationValue("AppSetting", "DefaultDataBase"); } Dictionary <string, DbConnectionOptions> dictRead = Configs.GetSection("DbConnections:" + dbConfigName + ":ReadDb").Get <Dictionary <string, DbConnectionOptions> >(); DbConnectionOptions dbConnectionOptions = new DbConnectionOptions(); bool isDBReadWriteSeparate = Configs.GetConfigurationValue("AppSetting", "IsDBReadWriteSeparate").ToBool(); if (masterDb || !isDBReadWriteSeparate) { dbConnectionOptions.ConnectionString = Configs.GetConfigurationValue("DbConnections:" + dbConfigName + ":MasterDB", "ConnectionString"); dbConnectionOptions.DatabaseType = (DatabaseType)Enum.Parse(typeof(DatabaseType), Configs.GetConfigurationValue("DbConnections:" + dbConfigName + ":MasterDB", "DatabaseType")); } else { dbConnectionOptions = GetReadConn(dictRead); } if (conStringEncrypt) { dbConnectionOptions.ConnectionString = DEncrypt.Decrypt(dbConnectionOptions.ConnectionString); } return(dbConnectionOptions); }
public ActionResult Loginaction() { string login_username = Request.Form["login_username"].ToString().Trim(); string login_password = DEncrypt.Encrypt(Request.Form["login_password"].ToString().Trim()); Psd.H5Show.BLL.user_account userAccountBll = new Psd.H5Show.BLL.user_account(); List <Psd.H5Show.Model.user_account> userAccountModelList = userAccountBll.GetModelList( string.Format("STATE='1' and DELFLAG='0' and UserCode='{0}' and `Password` ='{1}'", login_username, login_password)); if (userAccountModelList.Count > 0) { msgModel.Result = 1; msgModel.Msg = "登录成功"; HttpCookie cookie = new HttpCookie("PsdH5ShowUserCode"); cookie.Value = DEncrypt.Encrypt(userAccountModelList[0].UserCode); cookie.Expires = DateTime.Now.AddDays(1); HttpContext.Response.Cookies.Add(cookie); } else { msgModel.Result = 0; msgModel.Msg = "账号或密码错误"; } JsonResult Js = new JsonResult(); Js.Data = msgModel; Js.JsonRequestBehavior = JsonRequestBehavior.AllowGet; return(Js); }
/// <summary> /// 发送邮件 /// </summary> /// <param name="mailBodyEntity">邮件基础信息</param> public static SendResultEntity SendMail(MailBodyEntity mailBodyEntity) { var sendResultEntity = new SendResultEntity(); if (mailBodyEntity == null) { throw new ArgumentNullException(); } SendServerConfigurationEntity sendServerConfiguration = new SendServerConfigurationEntity(); YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper(); AppSetting sysSetting = yuebonCacheHelper.Get <AppSetting>("SysSetting"); if (sysSetting != null) { sendServerConfiguration.SmtpHost = DEncrypt.Decrypt(sysSetting.Emailsmtp); sendServerConfiguration.SenderAccount = sysSetting.Emailusername; sendServerConfiguration.SenderPassword = DEncrypt.Decrypt(sysSetting.Emailpassword); sendServerConfiguration.SmtpPort = sysSetting.Emailport.ToInt(); sendServerConfiguration.IsSsl = sysSetting.Emailssl.ToBool(); sendServerConfiguration.MailEncoding = "utf-8"; mailBodyEntity.Sender = sysSetting.Emailnickname; mailBodyEntity.SenderAddress = sysSetting.Emailusername; } else { sendResultEntity.ResultInformation = "邮件服务器未配置"; sendResultEntity.ResultStatus = false; throw new ArgumentNullException(); } sendResultEntity = SendMail(mailBodyEntity, sendServerConfiguration); return(sendResultEntity); }
public async Task <IActionResult> ResetPassword(string userId) { CommonResult result = new CommonResult(); try { string where = string.Format("UserId='{0}'", userId); UserLogOn userLogOn = userLogOnService.GetWhere(where); Random random = new Random(); string strRandom = random.Next(100000, 999999).ToString(); //生成编号 userLogOn.UserSecretkey = MD5Util.GetMD5_16(GuidUtils.NewGuidFormatN()).ToLower(); userLogOn.UserPassword = MD5Util.GetMD5_32(DEncrypt.Encrypt(MD5Util.GetMD5_32(strRandom).ToLower(), userLogOn.UserSecretkey).ToLower()).ToLower(); userLogOn.ChangePasswordDate = DateTime.Now; bool bl = await userLogOnService.UpdateAsync(userLogOn, userLogOn.Id); if (bl) { result.ErrCode = ErrCode.successCode; result.ErrMsg = strRandom; result.Success = true; } else { result.ErrMsg = ErrCode.err43002; result.ErrCode = "43002"; } }catch (Exception ex) { Log4NetHelper.Error("重置密码异常", ex);//错误记录 result.ErrMsg = ex.Message; } return(ToJsonContent(result)); }
public ActionResult Index(string username, string password, string returl, string remember_me) { string userData = string.Empty; var provider = new UserLoginProvider(); if (!provider.CheckUserName(username)) { ViewBag.message = "用户名不存在"; return(View()); } var user = provider.GetUser(username, DEncrypt.Md5(password)); if (user == null) { ViewBag.message = "用户名或密码不正确"; return(View()); } userData = user.UserName + "|" + user.DisplayName + "|" + user.Email; FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket( 1, user.UserName, DateTime.Now, remember_me != null ? DateTime.Now.AddDays(7) : DateTime.Now.AddMinutes(30), false, userData); string encTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie faCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket); Response.Cookies.Add(faCookie); return(new RedirectResult(returl == null ? "/" : returl)); }
protected void Button1_Click(object sender, EventArgs e) { string name = this.txt_name.Text.FilterSql(); string pwd = DEncrypt.Md5(this.txt_pwd.Text.FilterSql()); if (name.Length > 0 && pwd.Length > 0) { var user = new Tc.Model.TcAdmin(); if (user.Fill("name='" + name + "'")) { if (user.Pwd == pwd) { Session[LibAdmin.Session_admin] = user; Response.Redirect("main.aspx"); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('用户名或密码错误!请重新尝试!')", true); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('用户名或密码错误!请重新尝试!')", true); } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('请输入用户名和密码')", true); } }
/// <summary> /// 解密connectionsetting里加密的字符串(根据配置IsEncryptConnectionString决定是否解密) /// </summary> /// <param name="connectionName"></param> /// <returns></returns> public static string ValueOfEncryptConnectionString(this string connectionName) { return(DEncrypt.DecryptByConfig( System.Configuration.ConfigurationManager.AppSettings["IsEncryptConnectionString"], System.Configuration.ConfigurationManager.ConnectionStrings[connectionName].ConnectionString )); }
public JsonResult CheckLogin(BaseUser loginuser) { JsonResult json = new JsonResult(); OperateStatus op = new OperateStatus(); string checkVerify = DEncrypt.Get16_Md5Lower(loginuser.Code, null); if (Session["Login_VerifyCode"] == null || checkVerify != Session["Login_VerifyCode"].ToString()) { op.IsSuccessful = false; op.Message = "验证码不正确,请重新输入!"; } else { op = ouDal.CheckLogin(loginuser); if (op.IsSuccessful) { //记录Cookie //UserHelper.WrriteUserTokenCookie(loginuser.LoginName); op.IsSuccessful = true; op.Message = "登录成功!欢迎您!"; //记录Cookie UserHelper.WriteUserTokenCookie(loginuser.LoginName); } else { op.IsSuccessful = false; op.Message = op.Message ?? "用户名或密码错误!"; } } json.Data = op; return(json); }
public JsonResult CheckLogin(BaseUser loginuser) { OperateStatus op = new OperateStatus { IsSuccessful = false, Message = "初始异常!" }; string checkVerify = DEncrypt.Get16_Md5Lower(loginuser.Code, null); if (HttpContext.Session.GetString("Login_VerifyCode") == null || checkVerify != HttpContext.Session.GetString("Login_VerifyCode").ToString()) { op.IsSuccessful = false; op.Message = "验证码不正确,请重新输入!"; } else { op = ouDal.CheckLogin(loginuser); if (op.IsSuccessful) { op.IsSuccessful = true; op.Message = "登录成功!欢迎您!"; //记录Cookie UserHelper.WriteUserTokenCookie(loginuser.LoginName); } else { op.IsSuccessful = false; op.Message = op.Message ?? "用户名或密码错误!"; } } return(Json(op)); }
protected void btn_save_Click(object sender, EventArgs e) { var oldpwd = txt_oldpwd.Text.GetString(); var newpwd = txt_newpwd.Text.GetString(); var newpwd2 = txt_newpwd2.Text.GetString(); Model.TcAdmin admin = Common.LibAdmin.GetCurrentAdmin(); if (admin != null) { if (admin.Pwd.GetString() == DEncrypt.Md5(oldpwd)) { if (newpwd.Equals(newpwd2)) { admin.Pwd = DEncrypt.Md5(newpwd); admin.Update("id=" + MyID); alert("保存成功!"); } else { alert("确认密码与新密码不匹配,请重新输入"); } } else { alert("原密码输入不正确,请重新输入"); } } }
private ActionResult LoginMethod(User model, MyDbContext db, string returnurl) { Token t = new Token { ExpTime = DateTime.Now.AddMinutes(2), IsEnable = true, UserName = model.UserName }; db.Token.Add(t); db.SaveChanges(); string token = DEncrypt.Encrypt <Token>(t); //写入一个cookie,标识登陆成功 HttpCookie c = new HttpCookie(CommonHelper.LoginCookieName, DEncrypt.Encrypt(model.UserName)); c.Expires = DateTime.Now.AddDays(7); if (Request.Cookies[CommonHelper.LoginCookieName] == null) { Response.Cookies.Add(c); } else { Response.Cookies.Set(c); } string url = DEncrypt.Decrypt(returnurl); return(Redirect(url + "?token=" + Server.UrlEncode(token))); }
protected void ImageButton1_Click(object sender, EventArgs e) { string pwd = txt_oldpwd.Text.Trim(); string newpwd = txt_newpwd.Text.Trim(); string newpwd2 = txt_newpwd2.Text.Trim(); if (newpwd == newpwd2) { BLL.TcAdmin ado = new BLL.TcAdmin(); if (DEncrypt.Encrypt(pwd).ToLower() == My.Pwd.ToLower()) { if (txt_title.Text.Trim().Length > 0) { My.Name = txt_title.Text; } My.Pwd = DEncrypt.Encrypt(newpwd); ado.Update(My); Session[LibAdmin.Session_admin] = My; Alert("保存成功!"); } else { Alert("原密码错误!"); } } else { Alert("两次密码不一致!"); } }
public VolunteerAddViewModel GetMyInfos(SearchByVIDModel vidModel) { DEncrypt encrypt = new DEncrypt(); VolunteerAddViewModel model = new VolunteerAddViewModel(); Volunteer_Info info = _IVolunteerInfoRepository.SearchInfoByID(vidModel.VID); if (info != null && info.ID != null) { model = _IMapper.Map <Volunteer_Info, VolunteerAddViewModel>(info); List <Volunteer_Relate_Type> Relate_Types = _IVolunteer_Relate_TypeRepository.GetMyTypeList(vidModel.VID); model.RelateUserIDandTypeIDList = _IMapper.Map <List <Volunteer_Relate_Type>, List <Volunteer_Relate_TypeMiddle> >(Relate_Types); List <VAttachment> VAttachmentList = _IVAttachmentRepository.GetMyList(vidModel.VID); model.VAttachmentAddList = _IMapper.Map <List <VAttachment>, List <VAttachmentAddViewModel> >(VAttachmentList); model.Name = encrypt.Decrypt(model.Name); model.CertificateID = encrypt.Decrypt(model.CertificateID); model.Mobile = encrypt.Decrypt(model.Mobile); } return(model); }
protected void Button1_Click(object sender, EventArgs e) { string name = this.txt_name.Text.Replace("'", "").FilterSql(); string pwd = DEncrypt.Encrypt(this.txt_pwd.Text.FilterSql()); if (name.Length > 0 && pwd.Length > 0) { Tc.BLL.TcAdmin ao = new Tc.BLL.TcAdmin(); List <Tc.Model.TcAdmin> t = ao.GetModelList("name='" + name + "'"); if (t.Count <= 0) { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('用户名或密码错误!请重新尝试!')", true); } else { if (t[0].Pwd.GetString().ToLower() == pwd.ToLower()) { Session[LibAdmin.Session_admin] = t[0]; Response.Redirect("main.aspx"); } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('用户名或密码错误!请重新尝试')", true); } } } else { ClientScript.RegisterClientScriptBlock(this.GetType(), "login", "alert('请输入用户名和密码')", true); } }
/// <summary> /// 解密connectionsetting里加密的字符串(根据配置IsEncryptConnectionString决定是否解密) /// </summary> /// <param name="connectionName"></param> /// <returns></returns> public static string ValueOfEncryptAppSettingString(this string settingKey) { return(DEncrypt.DecryptByConfig( System.Configuration.ConfigurationManager.AppSettings["IsEncryptConnectionString"], System.Configuration.ConfigurationManager.AppSettings[settingKey] )); }
public ActionResult UserAdd(UserInfo info) { if (string.IsNullOrEmpty(info.ID)) { info.ID = GuidHelper.GetUniqueID(); info.Password = DEncrypt.Encrypt(info.Password); if (UserService.Insert <UserInfo>(info)) { Result.IsOk = true; Result.Msg = "添加成功"; } else { Result.IsOk = false; Result.Msg = "添加失败"; } } else { if (UserService.Update <UserInfo>(info)) { Result.IsOk = true; Result.Msg = "更新成功"; } else { Result.IsOk = false; Result.Msg = "更新失败"; } } Result.RedirectUrl = "/User/UserList"; return(Json(Result)); }
/// <summary> /// 根据配置决定是否解密某个连接字符串 /// </summary> /// <param name="str"></param> /// <returns></returns> public static string ValueOfDecryptString(this string str) { return(DEncrypt.DecryptByConfig( System.Configuration.ConfigurationManager.AppSettings["IsEncryptConnectionString"], str )); }
protected void ImageButton1_Click(object sender, ImageClickEventArgs e) { // 1. 这里放置保存窗体中数据的逻辑 var bllxs = BLL.TcAdmin.Instance; var mxs = id > 0 ? bllxs.GetModel(id) : new Model.TcAdmin(); if (mxs == null) { mxs = new Model.TcAdmin(); } mxs.Name = txt_title.Text.Trim().GetString(); string pwd = txt_pwd.Text.Trim(); string pwd2 = txt_pwd2.Text.Trim(); if (pwd == pwd2) { mxs.Pwd = DEncrypt.Encrypt(pwd); var dt = bllxs.GetList("name='" + mxs.Name + "'").Tables[0]; if (id > 0) { if (dt.Rows.Count > 0) { var i = dt.Rows[0]["id"].GetString().GetInt(); if (i != id) { Alert("登录名已经存在!"); } else { bllxs.Update(mxs);//更新 Alert("保存成功!"); } } else { bllxs.Update(mxs);//更新 Alert("保存成功!"); } } else { mxs.Role = 2; if (dt.Rows.Count > 0) { Alert("登录名已经存在!"); } else { bllxs.Add(mxs);//添加 Alert("保存成功!"); } } } else { Alert("两次密码输入不一致!"); } }
public IActionResult YuebonConnecSys(string systype) { CommonResult result = new CommonResult(); try { if (!string.IsNullOrEmpty(systype)) { SystemType systemType = iService.GetByCode(systype); string openmf = MD5Util.GetMD5_32(DEncrypt.Encrypt(CurrentUser.UserId + systemType.Id, GuidUtils.NewGuidFormatN())).ToLower(); YuebonCacheHelper yuebonCacheHelper = new YuebonCacheHelper(); TimeSpan expiresSliding = DateTime.Now.AddSeconds(20) - DateTime.Now; yuebonCacheHelper.Add("openmf" + openmf, CurrentUser.UserId, expiresSliding, false); result.ErrCode = ErrCode.successCode; result.ResData = systemType.Url + "?openmf=" + openmf; } else { result.ErrCode = ErrCode.failCode; result.ErrMsg = "切换子系统参数错误"; } } catch (Exception ex) { Log4NetHelper.Error("切换子系统异常", ex); result.ErrMsg = ErrCode.err40110; result.ErrCode = "40110"; } return(ToJsonContent(result)); }
//todo unitested public void UpdatePassword(int id, string oldPassword, string newPassword, string reNewPassword) { string enOldPwd = DEncrypt.Encrypt(oldPassword, Key); string enNewPwd = DEncrypt.Encrypt(newPassword, Key); if (newPassword != reNewPassword) { throw new BussinessException(ERROR_TWO_INPUT_PASSWORD_DIFFERENT); } if (newPassword.Length >= 32) { throw new BussinessException(ERROR_PWD_LEN_MORE_THAN_32); } var user = GetUser(id); if (user.Password != enOldPwd) { throw new BussinessException(ERROR_USERNAME_OR_PASSWORD); } if (user.Password == enNewPwd) { throw new BussinessException(ERROR_NEW_OLD_PASSOWRD_SAME); } _userDao.UpdatePassword(id, enNewPwd); }
public JsonResult SignIn(string username, string password) { var den = DEncrypt.AesEncode(password); try { string str = " Mobile = '" + username + "' and pass = '******'"; //var res = doc.GetModelList(str); var res = doc.GetModelList(str).FirstOrDefault(); if (res != null) { Response.Cookies["user"].Value = res.ID + "," + res.Name; Response.Cookies["user"].Expires = DateTime.Now.AddDays(1); //HttpCookie aCookie = new HttpCookie("lastVisit"); //aCookie.Value = DateTime.Now.ToString(); //aCookie.Expires = DateTime.Now.AddDays(1); //Response.Cookies.Add(aCookie); } return(Json(res, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(ex.Message, JsonRequestBehavior.AllowGet)); } }
public async Task <IActionResult> ModifyPassword(string oldpassword, string password, string password2) { CommonResult result = new CommonResult(); try { if (string.IsNullOrEmpty(oldpassword)) { result.ErrMsg = "原密码不能为空!"; } else if (string.IsNullOrEmpty(password)) { result.ErrMsg = "密码不能为空!"; } else if (string.IsNullOrEmpty(password2)) { result.ErrMsg = "重复输入密码不能为空!"; } else if (password == password2) { var userSinginEntity = userLogOnService.GetByUserId(CurrentUser.UserId); string inputPassword = MD5Util.GetMD5_32(DEncrypt.Encrypt(MD5Util.GetMD5_32(oldpassword).ToLower(), userSinginEntity.UserSecretkey).ToLower()).ToLower(); if (inputPassword != userSinginEntity.UserPassword) { result.ErrMsg = "原密码错误!"; } else { string where = string.Format("UserId='{0}'", CurrentUser.UserId); UserLogOn userLogOn = userLogOnService.GetWhere(where); userLogOn.UserSecretkey = MD5Util.GetMD5_16(GuidUtils.NewGuidFormatN()).ToLower(); userLogOn.UserPassword = MD5Util.GetMD5_32(DEncrypt.Encrypt(MD5Util.GetMD5_32(password).ToLower(), userLogOn.UserSecretkey).ToLower()).ToLower(); userLogOn.ChangePasswordDate = DateTime.Now; bool bl = await userLogOnService.UpdateAsync(userLogOn, userLogOn.Id); if (bl) { result.ErrCode = ErrCode.successCode; } else { result.ErrMsg = ErrCode.err43002; result.ErrCode = "43002"; } } } else { result.ErrMsg = "两次输入的密码不一样"; } } catch (Exception ex) { Log4NetHelper.Error("重置密码异常", ex);//错误记录 result.ErrMsg = ex.Message; } return(ToJsonContent(result)); }
/// <summary> /// 从cookie中拿到信息并解密 /// </summary> /// <param name="accessor"></param> /// <returns></returns> public static string GetCookie(this HttpContext httpContext, string cookieKey = CookieKey) { if (string.IsNullOrWhiteSpace(cookieKey)) { return(""); } return(DEncrypt.Decrypt(httpContext.Request.Cookies[cookieKey])); }
public void ResetPassword(int userId, string password) { if (password.Length >= 32) { throw new BussinessException(ERROR_PWD_LEN_MORE_THAN_32); } string enNewPwd = DEncrypt.Encrypt(password, Key); _userDao.UpdatePassword(userId, enNewPwd); }
/// <summary> /// 注册租户 /// </summary> /// <param name="entity"></param> /// <param name="tenantLogOnEntity"></param> public async Task <bool> InsertAsync(Tenant entity, TenantLogon tenantLogOnEntity) { tenantLogOnEntity.Id = GuidUtils.CreateNo(); tenantLogOnEntity.TenantId = entity.Id; tenantLogOnEntity.TenantSecretkey = MD5Util.GetMD5_16(GuidUtils.NewGuidFormatN()).ToLower(); tenantLogOnEntity.TenantPassword = MD5Util.GetMD5_32(DEncrypt.Encrypt(MD5Util.GetMD5_32(tenantLogOnEntity.TenantPassword).ToLower(), tenantLogOnEntity.TenantSecretkey).ToLower()).ToLower(); DbContext.GetDbSet <Tenant>().Add(entity); DbContext.GetDbSet <TenantLogon>().Add(tenantLogOnEntity); return(await DbContext.SaveChangesAsync() > 0); }
/// <summary> /// 注册用户 /// </summary> /// <param name="entity"></param> /// <param name="userLogOnEntity"></param> /// <param name="trans"></param> public bool Insert(User entity, UserLogOn userLogOnEntity, IDbTransaction trans = null) { userLogOnEntity.Id = GuidUtils.CreateNo(); userLogOnEntity.UserId = entity.Id; userLogOnEntity.UserSecretkey = MD5Util.GetMD5_16(GuidUtils.NewGuidFormatN()).ToLower(); userLogOnEntity.UserPassword = MD5Util.GetMD5_32(DEncrypt.Encrypt(MD5Util.GetMD5_32(userLogOnEntity.UserPassword).ToLower(), userLogOnEntity.UserSecretkey).ToLower()).ToLower(); DbContext.GetDbSet <User>().Add(entity); DbContext.GetDbSet <UserLogOn>().Add(userLogOnEntity); return(DbContext.SaveChanges() > 0); }
public ActionResult EditAgent(string id, string username, string password, string email, string displayname, string phone, string qq, string dlcs) { var provider = new UserLoginProvider(); if (!string.IsNullOrEmpty(id)) { var _user = provider.GetUser(username); if (_user != null) { _user.Email = email.Trim(); _user.Phone = phone.Trim(); _user.DisplayName = displayname.Trim(); _user.CreateDate = _user.CreateDate; var i = provider.UpdateUser(_user); if (i > 0) { var agentInfo = UserService.GetAgentInfoByUserId(_user.Id); if (agentInfo != null) { agentInfo.AgentCityId = Convert.ToInt64(dlcs); //agentInfo.UserId = i; agentInfo.QQNumber = qq ?? ""; //agentInfo.IsDelete = false; agentInfo.CreateDate = DateTime.Now; UserService.UpdateAgentInfo(agentInfo); } } } } else { var entity = new SysUser(); entity.UserName = username.Trim(); entity.Password = DEncrypt.Md5(password.Trim()); entity.Email = email.Trim(); entity.Phone = phone.Trim(); entity.Status = 1; entity.RuleType = RuleTypeEnum.Agents.ToString(); entity.DisplayName = displayname.Trim(); entity.CreateDate = DateTime.Now; var i = provider.InsertUser(entity); if (i > 0) { var agent = new SysAgentInfo(); agent.AgentCityId = Convert.ToInt64(dlcs); agent.UserId = i; agent.QQNumber = qq ?? ""; agent.IsDelete = false; agent.CreateDate = DateTime.Now; UserService.InsertAgentInfo(agent); } } return(Content("ok")); }
public void EncryptTest() { string original = "我是谁"; string expected = string.Empty; // TODO: 初始化为适当的值 string actual; actual = DEncrypt.Encrypt(original); var result = DEncrypt.Decrypt(actual); Assert.AreEqual(original, result); }
public List <VScoreRankMiddle> GetScoreRanks() { DEncrypt encrypt = new DEncrypt(); List <VScoreRankMiddle> result = _SqlRepository.GetScoreRank(); foreach (var item in result) { item.Name = encrypt.Decrypt(item.Name); } return(result); }
public User Login(string userName, string password) { string enPwd = DEncrypt.Encrypt(password, Key); var user = GetUserFromUserPo(_userDao.GetUserByUserNameAndPassword(userName, enPwd)); if (!user.IsValid) { return(null); } return(user); }