protected void btnNext_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtMobile.Value)) { lblError.InnerText = "请输入手机号"; return; } UserRegist context = Session["context"] as UserRegist; if (context == null) { lblError.InnerText = "请输入合理的验证码"; return; } if (context.Mobile == txtMobile.Value && context.VerCode == txtVerCode.Value) { Response.Redirect("findPass2.aspx"); } else { lblError.InnerText = "请输入合理的验证码"; } }
protected void Page_Load(object sender, EventArgs e) { UserRegist context = Session["context"] as UserRegist; if (context == null) { Response.Redirect("Register1.aspx"); } }
public static void OnPacket(Client client, object pack) { ReqRegist req = pack as ReqRegist; UserRegist rsp = new UserRegist(); UserInfo userInfo = UserSystem.me.GetByUsername(req.Username); if (userInfo != null) { rsp.ErrorCode = 1; client.Send(rsp); return; } userInfo = UserSystem.me.NewUser(req.Username, req.Password); HeroSystem.me.NewHero(userInfo.Id, 2); HeroSystem.me.NewHero(userInfo.Id, 3); userInfo.HeroList = HeroSystem.me.AllHeros(userInfo.Id); rsp.ErrorCode = 0; rsp.UserInfo = userInfo; client.Send(rsp); //string cmd = String.Format("select * from user where Username='******'", req.Username); //MySqlDataReader reader = Database.me.ExecQuery(cmd); //if (reader.Read()) //{ // reader.Close(); // rsp.ErrorCode = 1; // client.Send(rsp); // return; //} ////reader.Close(); //string cmd = String.Format("INSERT INTO `user`(`UserName`, `Password`, `Coin`) VALUES ('{0}','{1}',10)", req.Username, req.Password); //Database.me.ExecNonQuery(cmd); //cmd = String.Format("select * from user where Username='******'", req.Username); //MySqlDataReader reader = Database.me.ExecQuery(cmd); //if (reader.Read()) //{ // rsp.ErrorCode = 0; // rsp.UserInfo = new UserInfo(); // rsp.UserInfo.Id = reader.GetInt32("Id"); // rsp.UserInfo.Username = reader.GetString("Username"); // rsp.UserInfo.Coin = reader.GetInt32("Coin"); // reader.Close(); // client.Send(rsp); //} }
public static void OnPacket(object pack) { Debug.Log("OnPacket_UserRegist"); UserRegist userRegist = pack as UserRegist; if (userRegist.ErrorCode == 0) { Debug.Log("Regist Succeed"); Gamedata.me.userinfo = userRegist.UserInfo; PanelManager.me.Get((int)PanelId.PanelLogon).Hide(); PanelManager.me.Get((int)PanelId.PanelSetting).Show(); } else if (userRegist.ErrorCode == 1) { Debug.Log("Username has already exist."); } }
public ActionResult Register(Register UserModel) { if (string.IsNullOrEmpty(UserModel.UName)) { ModelState.AddModelError("UserName", "用户名不能为空"); } if (string.IsNullOrEmpty(UserModel.Password)) { ModelState.AddModelError("PassWord", "密码不能为空"); } else if (UserModel.Password.Length < 6) { ModelState.AddModelError("PassWord", "密码长度不能少于6位"); } if (string.IsNullOrEmpty(UserModel.Phone)) { ModelState.AddModelError("Phone", "手机号码不能为空"); } else if (UserModel.Phone.Length < 11) { ModelState.AddModelError("Phone", "手机号码格式不正确"); } if (ModelState.IsValid) { UserRegist user = new UserRegist(); bool res = user.RegistData(UserModel); if (res == true) { string script = string.Format("<script>alert('注册成功!');location.href='{0}'</script>", Url.Action("Login", "Account", "User")); return(Content(script, "text/html")); } else { string script = string.Format("<script>alert('注册失败!');location.href='{0}'</script>", Url.Action("Register", "Account", "User")); return(Content(script, "text/html")); } } return(View("Register")); }
protected void btnOK_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtPassword1.Value) || string.IsNullOrEmpty(txtPassword2.Value)) { lblError.InnerText = "请填写密码"; return; } if (txtPassword1.Value.Length < 6 || txtPassword1.Value.Length > 16) { lblError.InnerText = "密码必须6到16个字符"; return; } if (txtPassword1.Value != txtPassword2.Value) { lblError.InnerText = "密码不一致"; return; } if (!PassStrongCheck(txtPassword1.Value)) { lblError.InnerText = "密码必须包含数字、小写或大写字母"; return; } UserRegist context = Session["context"] as UserRegist; UserBLL bll = new UserBLL(); var res = bll.ModifyPass(context.Mobile, txtPassword1.Value); if (res.IsSuccess == true) { Session.Clear(); Response.Redirect("FindPass3.aspx"); } else { lblError.InnerText = res.Message; return; } }
protected void btnOK_Click(object sender, EventArgs e) { int nodeType = int.Parse(selNodeType.SelectedValue); if (nodeType == 0) { if (string.IsNullOrEmpty(txtNodeName.Value)) { lblError.InnerText = "请填写企业名称"; return; } if (string.IsNullOrEmpty(txtUCode.Value)) { lblError.InnerText = "请填写社会统一化代码"; return; } } if (string.IsNullOrEmpty(txtUserName.Value)) { lblError.InnerText = "请填写用户名"; return; } if (string.IsNullOrEmpty(txtPassword1.Value) || string.IsNullOrEmpty(txtPassword2.Value)) { lblError.InnerText = "请填写密码"; return; } if (txtPassword1.Value.Length < 6 || txtPassword1.Value.Length > 16) { lblError.InnerText = "密码必须6到16个字符"; return; } if (txtPassword1.Value != txtPassword2.Value) { lblError.InnerText = "密码不一致"; return; } if (!PassStrongCheck(txtPassword1.Value)) { lblError.InnerText = "密码必须包含数字、小写或大写字母"; return; } UserRegist context = Session["context"] as UserRegist; RequestUserRegister request = new RequestUserRegister(); request.User = new TKS.FAS.Entity.TKS_FAS_User(); request.User.UserName = txtUserName.Value.Trim(); request.User.Password = txtPassword1.Value; request.User.Sex = selSex.SelectedValue; request.User.Mobile = context.Mobile; request.User.ZCService = chkZC.Checked ? 1 : 0; request.User.Province = txtProvince.Value; request.User.City = txtCity.Value; request.User.Town = txtTown.Value; request.Node = new TKS.FAS.Entity.TKS_FAS_Node(); request.Node.Name = txtNodeName.Value.Trim(); request.Node.Type = nodeType; request.Node.IsOutSource = int.Parse(selOUT.SelectedValue); request.Node.UCode = txtUCode.Value; UserBLL bll = new UserBLL(); var res = bll.UserRegister(request); if (res.IsSuccess == true) { Session.Clear(); Response.Redirect("Register3.aspx"); } else { lblError.InnerText = res.Message; return; } }
void ShowRegist(object sender, MouseButtonEventArgs e) { loading.Show(); this.Children.Remove(sender as WindowBase); UserRegist userRegist = new UserRegist() { Z = 7 }; userRegist.Registed += new MouseButtonEventHandler(ShowLogin); userRegist.Cannel += new MouseButtonEventHandler(ShowLogin); userRegist.ResourceReady += (s1, e1) => { loading.Hide(); double startX = (Application.Current.Host.Content.ActualWidth - 370) / 2; double startY = (Application.Current.Host.Content.ActualHeight - 290) / 2; this.Children.Add(userRegist); userRegist.MoveTo(startX + 160, startX, startY - 120, startY, 3, new PowerEase() { EasingMode = EasingMode.EaseOut }); }; userRegist.Show(); }