📄 pspasscontrol.cs
字号:
this.lbAddBuddyTip.Size = new Size(0x7d, 12);
this.lbAddBuddyTip.TabIndex = 12;
this.lbAddBuddyTip.Text = "其他人添加我为好友时";
this.groupBox2.Controls.Add(this.lbAddBuddyTip);
this.groupBox2.Controls.Add(this.rbAgreeAll);
this.groupBox2.Controls.Add(this.rbNeedApply);
this.groupBox2.Controls.Add(this.rbRejectAll);
this.groupBox2.Location = new System.Drawing.Point(3, 0xb3);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new Size(0x19e, 0x53);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "好友身份验证";
this.groupBox2.Enter += new EventHandler(this.groupBox2_Enter);
this.groupBox3.Controls.Add(this.cbStrangerBlock);
this.groupBox3.Location = new System.Drawing.Point(3, 0x10c);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new Size(0x19e, 0x39);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "陌生人联系验证";
this.groupBox4.Controls.Add(this.xcbIvrBuddy);
this.groupBox4.Controls.Add(this.xcbIvrElse);
this.groupBox4.Controls.Add(this.xLabel2);
this.groupBox4.Controls.Add(this.xLabel1);
this.groupBox4.Location = new System.Drawing.Point(3, 0x14b);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new Size(0x19e, 0x4d);
this.groupBox4.TabIndex = 3;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "手机语聊";
this.xLabel2.set_AutoSize(true);
this.xLabel2.BorderColor = Color.Empty;
this.xLabel2.ButtonBorderStyle = ButtonBorderStyle.None;
this.xLabel2.Location = new System.Drawing.Point(0x1b, 0x36);
this.xLabel2.Name = "xLabel2";
this.xLabel2.Size = new Size(0xad, 12);
this.xLabel2.TabIndex = 0x15;
this.xLabel2.Text = "其他人向我发出手机语聊邀请时";
this.xLabel1.set_AutoSize(true);
this.xLabel1.BorderColor = Color.Empty;
this.xLabel1.ButtonBorderStyle = ButtonBorderStyle.None;
this.xLabel1.Location = new System.Drawing.Point(0x1b, 0x17);
this.xLabel1.Name = "xLabel1";
this.xLabel1.Size = new Size(0xa1, 12);
this.xLabel1.TabIndex = 20;
this.xLabel1.Text = "好友向我发出手机语聊邀请时";
base.set_AutoScaleDimensions(new SizeF(6f, 12f));
base.set_AutoScaleMode(1);
base.Controls.Add(this.groupBox4);
base.Controls.Add(this.groupBox3);
base.Controls.Add(this.groupBox2);
base.Controls.Add(this.groupBox1);
base.Name = "PsPassControl";
base.Size = new Size(420, 480);
base.Load += new EventHandler(this.PsPassControl_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.groupBox4.ResumeLayout(false);
this.groupBox4.PerformLayout();
base.ResumeLayout(false);
}
private void initIvrBuddyComboBox()
{
ValueNameDescList<int> list = new ValueNameDescList<int>();
list.Add(0, StringTable.Permission.Ivr_Reject);
list.Add(1, StringTable.Permission.Ivr_NeedApply);
list.Add(2, StringTable.Permission.Ivr_Permit);
this._listIvrBuddy = list;
OptionsControlBase.InnerSetListControlDataSource(this.xcbIvrBuddy, list);
}
private bool InnerCheckUserInput()
{
string password = this.tbOldPwd.Text;
string pass = this.tbNewPwd.Text;
if (password.Length <= 0)
{
BalloonHelper.ShowInputErrorBallon(this.tbOldPwd, StringTable.PersonalInfo.OldPasswordNotEmpty, StringTable.Options.TitleInvalidInput);
return false;
}
if (FuncLimitedSetting.SSIEncryptLoginLimited)
{
if (password != this.CurrentUser.Password)
{
BalloonHelper.ShowInputErrorBallon(this.tbOldPwd, StringTable.PersonalInfo.OldPasswordNotCorrect, StringTable.Options.TitleInvalidInput);
return false;
}
}
else if (!this.CurrentUser.IsPasswordCorrect(password))
{
BalloonHelper.ShowInputErrorBallon(this.tbOldPwd, StringTable.PersonalInfo.OldPasswordNotCorrect, StringTable.Options.TitleInvalidInput);
return false;
}
if (pass.Length <= 0)
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwd, StringTable.PersonalInfo.NewPasswordNotEmpty, StringTable.Options.TitleInvalidInput);
return false;
}
if (password == pass)
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwd, StringTable.PersonalInfo.NewPasswordSameAsOld, StringTable.Options.TitleInvalidInput);
return false;
}
if ((pass.Length < 6) || (pass.Length > 0x10))
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwd, StringTable.PersonalInfo.NewPasswordLengthInvalid, StringTable.Options.TitleInvalidInput);
return false;
}
if (!ControlHelper.IsValidPassword(pass))
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwd, StringTable.PersonalInfo.NewPasswordInvalid, StringTable.Options.TitleInvalidInput);
return false;
}
if (this.tbNewPwdConfirm.Text.Length <= 0)
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwdConfirm, StringTable.PersonalInfo.NewPasswordConfirmNotEmpty, StringTable.Options.TitleInvalidInput);
return false;
}
if (pass != this.tbNewPwdConfirm.Text)
{
BalloonHelper.ShowInputErrorBallon(this.tbNewPwdConfirm, StringTable.PersonalInfo.NewPasswordDiff, StringTable.Options.TitleInvalidInput);
return false;
}
return true;
}
private void op_ImpsError(object sender, ImpsErrorEventArgs e)
{
this.btnChangePassword.Enabled = true;
this._frameworkWindow.UnifiedMessageBox.ShowError(this, StringTable.PersonalInfo.MsgChangePassword_Failed, e.ToString());
}
private void op_Successed(object sender, EventArgs e)
{
try
{
string s = this.tbNewPwd.Text;
UserAccounts.LaststAccountNewPassword = this.CurrentUser.HashPassword(Encoding.UTF8.GetBytes(s));
UserAccounts.TrySaveLastestAccount(true);
((EntryPointControl) this._frameworkWindow.AccountManager.EntryPointControl).LoadUserAccounts();
}
catch (Exception exception)
{
ClientLogger.WriteGeneral("Save new password failed.", exception.ToString(), 10);
}
this.btnChangePassword.Enabled = true;
this.UpdateData(false);
this._frameworkWindow.UnifiedMessageBox.ShowInfo(this, StringTable.PersonalInfo.MsgChangePassword_200);
}
private void PsPassControl_Load(object sender, EventArgs e)
{
this.btnChangePassword.Text = StringTable.Password.BtnChangePassword;
this.lbRule.Text = StringTable.Password.PasswordRules;
}
private void ReFillIvrElseComboBox()
{
int selectedIndex = this.xcbIvrBuddy.SelectedIndex;
int num2 = this.xcbIvrElse.SelectedIndex;
ValueNameDescList<int> list = new ValueNameDescList<int>();
for (int i = 0; i <= selectedIndex; i++)
{
list.Add(this._listIvrBuddy[i]);
}
OptionsControlBase.InnerSetListControlDataSource(this.xcbIvrElse, list);
int num4 = Math.Min(num2, list.Count - 1);
if (num4 >= 0)
{
this.xcbIvrElse.SelectedIndex = num4;
}
}
private void selectIvr()
{
switch (this._user.GlobalPermission[PermissionPointName.Ivr].Value.Value)
{
case 0:
this.xcbIvrBuddy.SelectedValue = 0;
this.xcbIvrElse.SelectedValue = 0;
return;
case 1:
this.xcbIvrBuddy.SelectedValue = 2;
this.xcbIvrElse.SelectedValue = 2;
return;
case 2:
this.xcbIvrBuddy.SelectedValue = 2;
this.xcbIvrElse.SelectedValue = 1;
return;
case 3:
this.xcbIvrBuddy.SelectedValue = 2;
this.xcbIvrElse.SelectedValue = 0;
return;
case 4:
this.xcbIvrBuddy.SelectedValue = 1;
this.xcbIvrElse.SelectedValue = 1;
return;
case 5:
this.xcbIvrBuddy.SelectedValue = 1;
this.xcbIvrElse.SelectedValue = 0;
return;
}
}
private void SetLimitation()
{
this.tbOldPwd.MaxLength = 0x20;
this.tbNewPwd.MaxLength = 0x10;
this.tbNewPwdConfirm.MaxLength = 0x10;
ControlHelper.SetAcceptPasswordChar(this.tbNewPwd, true);
ControlHelper.SetAcceptPasswordChar(this.tbNewPwdConfirm, true);
ControlHelper.SetAcceptPasswordChar(this.tbOldPwd, true);
}
private void uiData_Changed(object sender, EventArgs e)
{
UiErrorHelper.HandEventSafely(this._frameworkWindow, delegate {
base.Modified = true;
});
}
public override bool UpdateData(bool update)
{
if (update)
{
if (!this.CheckUserInput())
{
return false;
}
if (this.rbAgreeAll.Checked)
{
this._user.GlobalPermission[PermissionPointName.Buddy].Value.ProposedValue = 1;
}
else if (this.rbNeedApply.Checked)
{
this._user.GlobalPermission[PermissionPointName.Buddy].Value.ProposedValue = 2;
}
else if (this.rbRejectAll.Checked)
{
this._user.GlobalPermission[PermissionPointName.Buddy].Value.ProposedValue = 0;
}
if (this.cbStrangerBlock.Checked)
{
this._user.GlobalPermission[PermissionPointName.Contact].Value.ProposedValue = 0;
}
else
{
this._user.GlobalPermission[PermissionPointName.Contact].Value.ProposedValue = 1;
}
int num = this.getIvrValue();
this._user.GlobalPermission[PermissionPointName.Ivr].Value.ProposedValue = num;
}
else
{
if (this._user.GlobalPermission[PermissionPointName.Buddy].Value == 1)
{
this.rbAgreeAll.Checked = true;
}
else if (this._user.GlobalPermission[PermissionPointName.Buddy].Value == 2)
{
this.rbNeedApply.Checked = true;
}
else if (this._user.GlobalPermission[PermissionPointName.Buddy].Value == null)
{
this.rbRejectAll.Checked = true;
}
if (this._user.GlobalPermission[PermissionPointName.Contact].Value == 1)
{
this.cbStrangerBlock.Checked = false;
}
else
{
this.cbStrangerBlock.Checked = true;
}
this.selectIvr();
this.DoEnableIvrElse();
this.tbOldPwd.Text = string.Empty;
this.tbNewPwd.Text = string.Empty;
this.tbNewPwdConfirm.Text = string.Empty;
}
base.Modified = false;
return true;
}
private void xcbIvrBuddy_SelectedIndexChanged(object sender, EventArgs e)
{
this.ReFillIvrElseComboBox();
}
private Imps.Client.Core.User _user
{
get
{
return this._frameworkWindow.AccountManager.CurrentUser;
}
}
private Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWindow.AccountManager.CurrentUser;
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -