private void btnOk_Click(object sender, EventArgs e) { if (tbUserPwd.Text == "" | tbUserID.Text.Length < 6 | tbPwd2.Text == "") { CCWin.MessageBoxEx.Show("账号长度不够或输入信息为空,请重新输入!", "提示:"); return; } if (tbUserPwd.Text.Trim() != tbPwd2.Text.Trim()) { CCWin.MessageBoxEx.Show("两次密码输入不一致,请重新输入!", "提示:"); tbUserPwd.Text = ""; tbPwd2.Text = ""; return; } var user = User.Find(User._.UserId == tbUserID.Text.Trim()); if (user != null) { CCWin.MessageBoxEx.Show("此账号已被注册,请重新输入!", "提示:"); tbUserID.Text = ""; return; } new User { SerialCode = Guid.NewGuid().ToString("N"), UserId = tbUserID.Text.Trim(), UserPwd = EncryptsHelper.Encrypt(tbUserPwd.Text.Trim()), UserType = 1, CreatTime = DBManager.Instance.GetCruTime(), LoginCount = 0 }.Save(); CCWin.MessageBoxEx.Show("注册成功!", "提示:"); this.Close(); }
private void skinListBox1_DoubleClick(object sender, EventArgs e) { if (skinListBox1.SelectedItem != null) { SkinListBoxItem item = skinListBox1.SelectedItem as SkinListBoxItem; string hostname = EncryptsHelper.Encrypt(item.Tag.ToString()); ShadowsocksR ssR = ShadowsocksR.Find(ShadowsocksR._.HostName == hostname); if (ssR != null) { MainFrm.shadowsocksR = ssR; DialogResult = DialogResult.OK; Close(); } else { CCWin.MessageBoxEx.Show("节点选择异常,请稍后重试!", "提示"); Close(); } } }
private void btnOk_Click(object sender, EventArgs e) { try { string userid = tbUserID.Text.Trim(); string userpwd = tbUserPwd.Text.Trim(); User user = User.Find(User._.UserId == userid & User._.UserPwd == EncryptsHelper.Encrypt(userpwd)); if (user == null) { CCWin.MessageBoxEx.Show("用户名或密码错误,请重新输入!", "提示;"); this.DialogResult = DialogResult.No; return; } user.LoginCount++; user.Update(); MainFrm.user = user; this.DialogResult = DialogResult.OK; if (MySetting.Default.RemmberUser) { MySetting.Default.UserID = user.UserId; MySetting.Default.UserPwd = user.UserPwd; } MySetting.Default.RemmberUser = skinCheckBox1.Checked; MySetting.Default.AutoLogin = skinCheckBox2.Checked; MySetting.Default.Save(); } catch (Exception ex) { CCWin.MessageBoxEx.Show("登录出现异常,请稍后重试!", "提示;"); } }