public async Task <IActionResult> Put([FromBody] AccountEditModel model) { var mapping = new Func <Account, Task <Account> >(async(entity) => { if (!string.IsNullOrWhiteSpace(model.Name)) { entity.Name = model.Name; } if (!string.IsNullOrWhiteSpace(model.Description)) { entity.Description = model.Description; } if (!string.IsNullOrWhiteSpace(model.Password)) { entity.Password = Md5.CalcString(model.Password); } if (!string.IsNullOrWhiteSpace(model.ActivationTime)) { entity.ActivationTime = DataHelper.ParseDateTime(model.ActivationTime); } if (!string.IsNullOrWhiteSpace(model.ExpireTime)) { entity.ExpireTime = DataHelper.ParseDateTime(model.ExpireTime); } if (!string.IsNullOrWhiteSpace(model.DepartmentId)) { entity.DepartmentId = model.DepartmentId; } //else //{ // entity.DepartmentId = null; // entity.Department = null; //} entity.Mail = model.Mail; entity.Location = model.Location; entity.Phone = model.Phone; entity.Type = await _GetAccountType(model.IsAdmin, model.Id); return(await Task.FromResult(entity)); }); return(await _PutRequest(model.Id, mapping)); }
public override FileTransferResponsed Handle(ContextRequest request, FileWriteHandleContext context) { var r = request.FileRequest; //Console.WriteLine("StateFileLengthEqual"); var fs = request.WorkingStream; //bug : filestream appeared that has been closed string md5 = fs.CanRead ? Md5.GetMd5WithFileStream(fs, fs.Position) : Md5.GetMd5WithFilePath(request.WorkingPath); var progress = request.ProgressDic[r.FileMd5]; FileTransferResponsed responsed = new FileTransferResponsed(request.FileRequest) { IsSendingOver = true, FileMd5CheckResult = md5 == request.FileRequest.FileMd5 //文件长度相等,则视为已传输完毕 }; if (responsed.FileMd5CheckResult) { fs.Close(); var path = FileNameTools.GetDownloadedFullPath(request.WorkingPath); File.Move(request.WorkingPath, path);//modify filename progress.ProgressValue = progress.MaxValue; progress.StateMsg = "校验成功!"; try { request?.ReceiveProgressHandler?.OnReceiveEnd(r.FileMd5, true); //PubSubEvents.Singleton.Publish(new FileReceiveProgressCompleteEvent() { IsChecked = true,FileName = r.FileName }); } catch { // ignored } } else { request?.ReceiveProgressHandler?.OnReceiveEnd(r.FileMd5, false); progress.StateMsg = "校验失败!正在重新检查,请耐心等待。"; //PubSubEvents.Singleton.GetEvent<FileReceiveProgressCompleteEvent>().Publish(new FileReceiveProgressCompleteEvent() { IsChecked = false, FileName = r.FileName }); context.State = new StateFileNormalTransfer();//等待单个Block文件写入 } return(responsed); }
public ActionResult CheckLogin(string username, string password, string code) { LoginContent result = new LoginContent() { IsSmsLogin = "******", Msg = "用户名密码错误", Success = false, MoPhone = "", LoginType = (int)LoginTypeEnum.ManageMember }; try { if (string.IsNullOrEmpty(username)) { result.Msg = "用户名不能为空"; return(Content(result.ToJson())); } if (string.IsNullOrEmpty(password)) { result.Msg = "请输入密码"; return(Content(result.ToJson())); } if (Session["nfine_session_verifycode"].IsEmpty() || Md5.md5(code.ToLower(), 16) != Session["nfine_session_verifycode"].ToString()) { result.Msg = "验证码错误,请重新输入"; return(Content(result.ToJson())); } using (var bll = new LoginApp()) { result = bll.CheckLogin(username, password); } if (!result.Success) { result.Msg = "用户名密码错误"; } return(Content(result.ToJson())); } catch (Exception ex) { result.Msg = ex.Message; result.Success = false; return(Content(result.ToJson())); } }
public ActionResult Add(HR_Employee dto) { HKSJRecruitmentContext ctx = HttpContext.GetDbContext <HKSJRecruitmentContext>(); string uid = dto.uid; if (ctx.Tapp_User.Count(c => c.UserName == uid) > 0) { return(Content(this.GetJSON(new { Result = false, Msg = "账号[" + uid + "]已使用", Dto = dto }), this.JsonContentType())); } if (!dto.dptid.HasValue) { return(Content(this.GetJSON(new { Result = false, Msg = "请选择部门", Dto = dto }), this.JsonContentType())); } if (!dto.postid.HasValue) { return(Content(this.GetJSON(new { Result = false, Msg = "请选择职位", Dto = dto }), this.JsonContentType())); } int deptId = dto.dptid.Value; int postId = dto.postid.Value; if (ctx.TErp_Department.Count(c => c.Id == deptId && c.IsDelete == 0) == 0) { return(Content(this.GetJSON(new { Result = false, Msg = "部门不存在", Dto = dto }), this.JsonContentType())); } if (ctx.TErp_Position.Count(c => c.Id == postId && c.IsDelete == 0) == 0) { return(Content(this.GetJSON(new { Result = false, Msg = "职位不存在", Dto = dto }), this.JsonContentType())); } ctx.HR_Employee.Add(dto); Tapp_User use = new Tapp_User(); use.UserName = dto.uid; use.UserPwd = "123456"; use.State = 1; use.UserPwd = Md5.Encrypt(dto.uid + "123456"); ctx.Tapp_User.Add(use); if (ctx.SaveChanges() >= 0) { return(Content(this.GetJSON(new { Result = true, Msg = "成功", Dto = dto }), this.JsonContentType())); } return(Content(this.GetJSON(new { Result = false, Msg = "失败", Dto = dto }), this.JsonContentType())); }
public ActionResult Create(tblUser_Sys collection, string IsContinue = "0") { ReturnMessage RM = new ReturnMessage(false); try { if (collection.UserPwd == "" || string.IsNullOrEmpty(collection.UserPwd)) { //默认密码MD5加密 collection.UserPwd = Md5.Encode("123456"); } //根据登录名称查询是否已经存在, var query = BusinessContext.tblUser_Sys.Get(Query <tblUser_Sys> .EQ(t => t.LoginName, collection.LoginName)); if (query != null) { RM.Message = "登录名已被占用"; } else { //添加用户,并返回数据库ID,保存操作日志 var res = BusinessContext.tblUser_Sys.Add(collection); RM.IsSuccess = res; if (RM.IsSuccess) { //collection.Rid = Rid; tblUser_Roles tblUser_Roles = new tblUser_Roles(); tblUser_Roles.Role_Id = collection.DefaultRoleId; tblUser_Roles.LoginName = collection.LoginName; tblUser_Roles.IsDefault = true; BusinessContext.tblUser_Roles.Add(tblUser_Roles); OperateLogHelper.Create <tblUser_Roles>(tblUser_Roles); OperateLogHelper.Create <tblUser_Sys>(collection); //IsContinue 为1时保存并继续 RM.IsContinue = IsContinue == "1"; } } } catch (Exception ex) { RM.Message = ex.Message; } return(Json(RM)); }
public ActionResult Edit(string email, string name, string oldPassword = "", string newPassword = "", bool Deactivated = false) { var response = new AjaxResponse { Success = false }; var currentUser = (User)Session["User"]; var user = DbHelper.GetUser(currentUser.Id); var newMd5Password = Md5.CalculateMd5(newPassword); var validation = new Validation(); if (user == null) { response.Message = "You have to be logged in to change user information"; return(Json(response)); } if (!validation.ValidateEmail(email)) { response.Message = "You must provide a valid email"; return(Json(response)); } user.Email = string.IsNullOrEmpty(email) ? user.Email : email; user.Name = string.IsNullOrEmpty(name) ? user.Name : name; if (!string.IsNullOrEmpty(newPassword)) { if (Md5.CalculateMd5(oldPassword) == user.Password) { user.Password = newMd5Password; } else { response.Message = "The old password is not correct"; return(Json(response)); } } DbHelper.SaveUser(user); response.Success = true; response.Message = "User updated succesfully"; response.Data = GetSession(refresh: true); return(Json(response)); }
public override string SolvePart1( ) { var password = string.Empty; var count = 0; while (password.Length < 8) { var hash = Md5.HashToHexadecimal(Input[0] + count); if (hash.StartsWith("00000")) { password += hash[5]; } count++; } return(password); }
public async Task <T> ExecuteAsync <T>(HttpRequest request) where T : WeChatPayNotifyResponse { var body = await new StreamReader(request.Body, Encoding.UTF8).ReadToEndAsync(); var parser = new WeChatPayXmlParser <T>(); var rsp = parser.Parse(body); if (rsp is WeChatPayRefundNotifyResponse) { var key = Md5.GetMD5(Options.Key).ToLower(); var data = Aes.AesDecrypt(rsp.ReqInfo, key); // AES-256-ECB rsp = parser.Parse(rsp, data); } else { CheckNotifySign(rsp); } return(rsp); }
public bool insertry(ry ry) { String sql = "select * from ry where yhm='" + ry.yhm + "'"; using (var db = Connection) { long dc = 0; ry r = db.DbConnecttion.Query <ry>(sql, null).ToList().FirstOrDefault(); if (r != null) //用户名唯一,如果找到数据,就表示已经被注册了 { return(false); } //r为null ry.mm = Md5.GetMD5(ry.mm); db.Insert <ry>(ry); } return(true); }
public override int GetHashCode() { int hash = 1; if (Md5.Length != 0) { hash ^= Md5.GetHashCode(); } if (Version.Length != 0) { hash ^= Version.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
private static void DodajUzytkownika(Uprawnienia uprawnienia) { Uzytkownik uzytkownik = new Uzytkownik(); Console.Write("Firstname: "); uzytkownik.Imie = Console.ReadLine(); Console.Write("Lastname: "); uzytkownik.Nazwisko = Console.ReadLine(); Console.Write("Login: "******"Password: "******"Successfully added a new user"); }
public JsonResult LoginIn(string username, string password) { StatusAttribute res = new StatusAttribute(); DataTable dt = db.AccessReader("select password,ID from admins where username='******'"); if (dt.Rows.Count > 0 && dt.Rows[0][0].ToString() == Md5.GetMd5Word(username, password).ToString()) { res.status = true; res.message = "登录成功!"; HttpContext.Session["admin"] = dt.Rows[0][1]; } else { res.status = false; res.message = "登录失败!用户名或密码错误..."; } return(Json(res)); }
public static string ToMd5(this string value) { #if !PCL byte[] _buffer = Encoding.UTF8.GetBytes(value); var _md5 = Md5.Create(); byte[] _hash = _md5.ComputeHash(_buffer); var _ret = new StringBuilder(); for (int i = 0; i < _hash.Length; i++) { _ret.Append(_hash[i].ToString("x2")); } return(_ret.ToString()); #else return(""); #endif }
private String verifyStaff(STAFF staff, String password, int type) { if (staff != null) { if (Md5.verifyMd5Hash(password, staff.PASSWORD)) { return(AccountConstMessage.LOGIN_SUCCESS); } } if (type == BY_PHONE) { return(AccountConstMessage.INVALID_INFO_PHONE); } else { return(AccountConstMessage.INVALID_INFO_ID); } }
private void CheckResponseSign(QPayResponse response) { if (string.IsNullOrEmpty(response.Body)) { throw new Exception("sign check fail: Body is Empty!"); } var sign = response?.Sign; if (!response.IsError && !string.IsNullOrEmpty(sign)) { var cal_sign = Md5.GetMD5WithKey(response.Parameters, Options.Key); if (cal_sign != sign) { throw new Exception("sign check fail: check Sign and Data Fail!"); } } }
public ActionResult AddUser(User user) { user.AgreeCode = UserAgreeCode.Agree.GetEnumCode(); user.AgreeTime = DateTime.Now; user.AgreeUserID = user.CreatorUserId; user.SecretKey = Md5.md5(CommonUtility.CreateNo(), 16).ToLower(); user.Passsword = Md5.md5(DESEncrypt.Encrypt(Md5.md5(user.Passsword, 32).ToLower(), user.SecretKey).ToLower(), 32).ToLower(); var ret = userApp.AddUser(user); if (ret == 1) { return(Success("添加成功。")); } else { return(Error("添加失败")); } }
public int Login(Entity.LoginAdmin obj) { var Password = Md5.MD5Hash(obj.Password); int a = 0; using (var context = MasterDBContext()) { var cmd = context.StoredProcedure("dbo.LoginAdmin") .Parameter("UserName", obj.UserName) .Parameter("Password", Password) .ParameterOut("Total", FluentData.DataTypes.Int32); cmd.Execute(); a = cmd.ParameterValue <int>("Total"); } return(a); }
/// <summary> /// 对签名进行校验 /// </summary> /// <param name="requestModel">请求的模型</param> /// <returns></returns> public Tuple <bool, string, int> SecurityCheck(RequestModel <TUserInfoModel> requestModel) { //仅用于调试 //if (requestModel.Sign == "ignor") return true; //校验签名 (token+protocol+timestamp + 密钥)的MD5 var sign = Md5.GetMd5(requestModel.Token + requestModel.Api + requestModel.Timestamp + AccountSecretKey, Encoding.UTF8); if (sign == requestModel.Sign) { //签名正确 return(new Tuple <bool, string, int>(true, "签名正确。", Code.Sucess)); } else { //签名不正确 return(new Tuple <bool, string, int>(false, "签名不正确。", Code.SignErron)); } }
public ActionResult Edit(string email, string name, string oldPassword = "", string newPassword = "", bool Deactivated = false) { var response = new AjaxResponse(); var currentUser = Main.Session.GetCurrentUser(); var newMd5Password = Md5.CalculateMd5(newPassword); var validation = new Validation(); var player = DbHelper.GetPlayerByEmail(email); if (currentUser == null) { response.Message = "You have to be logged in to change user information"; return(Json(response)); } if (!validation.ValidateEmail(email)) { response.Message = "You must provide a valid email"; return(Json(response)); } currentUser.Email = string.IsNullOrEmpty(email) ? currentUser.Email : email; currentUser.Name = string.IsNullOrEmpty(name) ? currentUser.Name : name; player.Email = currentUser.Email; player.Name = currentUser.Name; if (!string.IsNullOrEmpty(newPassword)) { if (Md5.CalculateMd5(oldPassword) == currentUser.Password) { currentUser.Password = newMd5Password; } else { response.Message = "The old password is not correct"; return(Json(response)); } } DbHelper.SaveUser(currentUser); DbHelper.SavePlayer(player); response.Message = "User updated succesfully"; return(Json(response)); }
public JObject CreatAccount(JObject json) { using (var db = new RepositoryBase().BeginTrans()) { User _account = (User)JsonConvert.DeserializeObject(json.First.Path, typeof(User));//转换对象 User _userEntity = db.FindEntity <User>(t => t.Phone == _account.Phone); JObject result = new JObject(); if (_userEntity == null && _account.Name == null) { string dbPassword = Md5.EncryptString(_account.Password); User _currentLogin = new User(); _currentLogin.Id = Core.Common.CreatUser("P"); _currentLogin.Name = _account.Phone; _currentLogin.Password = dbPassword; _currentLogin.Phone = _account.Phone; _currentLogin.AddTime = DateTime.Now; _currentLogin.IsValiteLogin = true; db.Insert(_currentLogin); db.Commit(); result.Add(ResultInfo.Result, JToken.FromObject(true)); } else { if (_account.Name != null) { string dbPassword = Md5.EncryptString(_account.Password); User _user = db.FindEntity <User>(t => t.Name == _account.Name); _user.Phone = _account.Phone; _user.Password = dbPassword; _user.UpdateTime = DateTime.Now; _user.IsValiteLogin = true; db.Update(_user); db.Commit(); result.Add(ResultInfo.Result, JToken.FromObject(true)); } else { result.Add(ResultInfo.Result, JToken.FromObject(false)); result.Add(ResultInfo.Content, JToken.FromObject("账户已存在,请重新输入!")); } } return(result); } }
private void btnLogin_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.cboxUserName.Text)) { MessageBox.Show("请输入用户名"); this.cboxUserName.Focus(); return; } if (string.IsNullOrEmpty(this.txtPassword.Text)) { MessageBox.Show("请输入密码"); this.txtPassword.Focus(); return; } if (dal.LoginCheck(this.cboxUserName.Text, Md5.Encrypt(this.txtPassword.Text))) { XmlLoginUserEntity entity = new XmlLoginUserEntity() { UserName = this.cboxUserName.Text, Password = new Encryption().Encrypto(this.txtPassword.Text), CreateTime = DateTime.Now, AutoLogin = this.cboxAutoLogin.Checked ? "1" : "0", RememberPwd = this.cboxRememberPwd.Checked ? "1" : "0" }; if (xml.AddOrEditLoginedUserInfo(entity)) { frmMain main = new frmMain(entity.UserName, Md5.Encrypt(this.txtPassword.Text)); //隐藏当前窗体 this.WindowState = FormWindowState.Minimized; //this.ShowInTaskbar = false; if (main.ShowDialog() == DialogResult.Yes) { this.ShowInTaskbar = true; } else if (main.DialogResult == DialogResult.Cancel) { Application.Exit(); } return; } } }
public IActionResult Init() { using var trans = organizeService.DbContext.Database.BeginTransaction(); var organizeCat = new OrganizeCategoryEntity { Name = "管理办公室", Category = OrganizeCategoryEntity.Categories.Main, }; organizeCatService.Update(organizeCat); var organize = new OrganizeEntity { Name = "研发运维", CategoryId = organizeCat.Id, Category = organizeCat, }; organizeService.Update(organize); var user = new UserEntity { UserName = "******", RealName = "运维超级账号", Contract = "{\"wechat\":\"loyieking\"}", IsAdministrator = true, Password = Md5.Hash(DesEncrypt.Encrypt("adminadmin").ToLower(), 32).ToLower() }; userService.Update(user); var userOrganize = new UserOrganizeEntity { User = user, Organize = organize }; userOrganizeService.Update(userOrganize); trans.Commit(); return(Success()); }
/// <summary> /// 修改用户密码 /// </summary> /// <param name="uid">用户Id</param> /// <param name="old">原始密码</param> /// <param name="password">新密码</param> public void ModifyPassword(string uid, string old, string password) { cmsUser user = GetModelWithWhere(cmsUser._.UName == uid); if (user == null) { throw new Exception("用户信息不正确"); } else if (user.UPwd != Md5.Get32Md5(uid + old)) { throw new Exception("原始密码不正确"); } else { user.Attach(); user.UPwd = Md5.Get32Md5(uid + password); UpdateModel(user); } }
/// <summary> /// 处理登录的信息 /// </summary> /// <param name="userInfo"></param> /// <param name="CookieExpires">cookie有效期</param> /// <returns></returns> public ActionResult CheckUserLogin(UserEntity userInfo, string CookieExpires) { try { var iUserDal = DALUtility.User; var currentUser = iUserDal.UserLogin(userInfo.AccountName, Md5.GetMD5String(userInfo.Password)); if (currentUser != null) { if (currentUser.IsAble == false) { return(Content("用户已被禁用,请您联系管理员")); } //记录登录cookie CookiesHelper.SetCookie("UserID", AES.EncryptStr(currentUser.ID.ToString())); //记录用户登录所在IP LoginIpLogEntity logEntity = new LoginIpLogEntity(); string ip = CommFunc.Get_ClientIP(); if (string.IsNullOrEmpty(ip)) { logEntity.IpAddress = "localhost"; } else { logEntity.IpAddress = ip; } logEntity.CreateBy = currentUser.AccountName; logEntity.CreateTime = DateTime.Now; logEntity.UpdateBy = currentUser.AccountName; logEntity.UpdateTime = DateTime.Now; DALUtility.LoginIpLog.Add(logEntity); return(Content("OK")); } else { return(Content("用户名密码错误,请您检查")); } } catch (Exception ex) { return(Content("登录异常," + ex.Message)); } }
public IHttpActionResult AddUser(dynamic user) { string Msg = ""; string Status = "400"; string name = Convert.ToString(user.name); string email = Convert.ToString(user.email); string pwd = Convert.ToString(user.pwd); tbUser_Info userInfo = new tbUser_Info(); userInfo.User_Namestr = name; userInfo.User_Emailstr = email; userInfo.User_Pwdstr = Md5.GetMd5String(pwd); userInfo.User_CreateTimedate = DateTime.Now; string Code = CreateRenderCode.RenderCode(); userInfo.User_Codestr = Code; //激活码 userInfo.User_Sateint = Convert.ToInt32(Sate.Inactive); //0未激活 userInfo.User_Expdate = DateTime.Now.AddDays(2); //两天后过期 var newUserInfo = userInfoService.AddEntity(userInfo); if (newUserInfo != null) { Status = "200"; /* if (ALiYnEmail.SendEmail(name, Code, email)) * { * Msg = "邮件发送成功!"; * } * else * { * Msg = "邮件发送失败!"; * }*/ } else { Msg = "系统出错,请稍后重试!"; } return(Json <dynamic>(new { msg = Msg, status = Status, name = newUserInfo.User_Namestr })); }
/// <summary> /// 登录 /// </summary> public static void LoginPT() { try { string url = "http://oshop.sohan.hk/shop-login.do";//账号登录 string account = "EX_18606592298"; var verifycode = "2393"; string fresh = "0.9467887859438537"; string password = "******"; string passwordkey = Md5.StringToMD5Hash(verifycode + "" + Md5.StringToMD5Hash(password).ToLower()).ToLower(); string postDataStr = $"verifycode={verifycode}&usbname=&macsn=&passwordkey={passwordkey}&account={account}&fresh={fresh}&loginErrorNum="; string content = reuest.PostHtml(url, postDataStr); string time = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd"); reuest.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"; reuest.Referer = "http://oshop.sohan.hk/admin/listTacclist.do"; string queryHtml = reuest.GetHtml($"http://oshop.sohan.hk/admin/listTacclists.do?event=&tfeeTypeId=-1&startDate={time}&pageId=0&endDate={time}"); if (queryHtml != null && queryHtml.Contains("缴费成本")) { var response = reuest.GetStream($"http://oshop.sohan.hk/admin/excelTacclist.do?event=&tfeeTypeId=-1&startDate={time}&endDate={time}"); FileStream fileStream = new FileStream("账目清单" + time + ".csv", FileMode.Create, FileAccess.Write); } //HtmlDocument doc = new HtmlDocument(); //doc.LoadHtml(queryHtml); //var tableTrAll = doc.DocumentNode.SelectNodes("//table/tr"); //foreach ( var oneTr in tableTrAll) //{ // doc.LoadHtml(oneTr.InnerHtml); // var td = doc.DocumentNode.SelectNodes("//td"); // var ss =td[1].InnerHtml; //} } catch (Exception ex) { Console.WriteLine(ex.Message); // AddLog.UpdateLog(ex.Message); } }
public void CRAM_MD5による認証_失敗() { //setUp const bool usePlain = false; const bool useLogin = false; const bool useCramMd5 = true; var sut = new SmtpAuth(_smtpAuthUserList, usePlain, useLogin, useCramMd5); var str = sut.Job("AUTH CRAM-MD5"); var hash = Md5.Hash("user2", Base64.Decode(str.Substring(4))); var expected = (String)null; //exercise var actual = sut.Job(Base64.Encode(string.Format("user1 {0}", hash))); //verify Assert.That(actual, Is.EqualTo(expected)); }
public ActionResult ModifyPassword() { string pswd = Common.GetString("pswd"); string newpswd = Common.GetString("newpswd"); string repswd = Common.GetString("repswd"); var userLogOn = userLogOnApp.GetForm(); var oldpswd = Md5.md5(DESEncrypt.Encrypt(Md5.md5(pswd, 32).ToLower(), userLogOn.F_UserSecretkey).ToLower(), 32).ToLower(); if (userLogOn.F_UserPassword != oldpswd) { return(Error("原密码有误!")); } if (newpswd != repswd) { return(Error("确认密码和新密码不一致")); } userLogOnApp.ModifyPassword(newpswd, userLogOn.F_Id); return(Success("修改成功!")); }
/// <summary> /// JS脚本资源绑定添加 /// </summary> /// <param name="name">JS脚本资源绑定名称</param> /// <param name="scripts">js脚本路径数组</param> public static void BundlesAdd(string name, params string[] scripts) { if (!BundleScripts.ContainsKey(name)) { string virtualPath = "~/" + Md5.HalfEncryptHexString(name + "/Script"); BundleTable.Bundles.Add(new ScriptBundle(virtualPath).Include(scripts)); Bundles b = new Bundles() { item = scripts, name = name, virtualPath = virtualPath }; if (BundleScripts.Count == 0 && string.IsNullOrEmpty(BasisName)) { BasisName = name; } BundleScripts.Add(name, b); } }
public ActionResult Register(string email, string name, string password) { var userEmail = email.ToLower(); var userName = name; var userPassword = Md5.CalculateMd5(password); var validation = new Validation(); var ajaxResponse = validation.ValidateNewUserData(userEmail, userName, userPassword); if (!ajaxResponse.Success) { return(Json(ajaxResponse)); } var userCollection = Dbh.GetCollection <User>("Users"); var newUser = new User { Id = BsonObjectId.GenerateNewId().ToString(), Email = userEmail, Name = userName, Password = userPassword, }; var playerCollection = Dbh.GetCollection <Player>("Players"); var newPlayer = new Player { Id = BsonObjectId.GenerateNewId().ToString(), Email = userEmail, Name = userName, Password = userPassword, }; playerCollection.Save(newPlayer); userCollection.Save(newUser); var accessToken = Main.Session.CreateNewAccessTokenOnUser(newUser); Main.Session.SaveAccessToken(accessToken); ajaxResponse.Data = new { AccessToken = Main.Session.BuildSessionInfo(accessToken, newUser) }; return(Json(ajaxResponse)); }
public string CheckMd5(string test) { var md5 = new Md5 { Value = test }; return md5.FingerPrint.ToLower(); }