| | |
| | | /// 标记是否能够校验验证码了
|
| | | /// </summary>
|
| | | private bool canCheckCode = false;
|
| | | /// <summary>
|
| | | /// 能否发送验证码
|
| | | /// </summary>
|
| | | private bool canSendCode = true;
|
| | |
|
| | | #endregion
|
| | |
|
| | |
| | | frame.Height = Application.GetRealHeight(127);
|
| | | bodyFrameLayout.AddChidren(frame);
|
| | | //输入框
|
| | | var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - ControlCommonResourse.BottomLineHeight, false);
|
| | | var txtValue = new TextInputControl(frame.Width - Application.GetRealWidth(20), frame.Height - HdlControlResourse.BottomLineHeight, false);
|
| | | txtValue.X = Application.GetRealWidth(10);
|
| | | txtValue.PlaceholderText = Language.StringByID(R.MyInternationalizationString.uPleaseInputNewEmailAddress);
|
| | | frame.AddChidren(txtValue);
|
| | |
|
| | | //线
|
| | | var btnLine = new NormalViewControl(frame.Width, ControlCommonResourse.BottomLineHeight, false);
|
| | | var btnLine = new NormalViewControl(frame.Width, HdlControlResourse.BottomLineHeight, false);
|
| | | btnLine.Y = txtValue.Bottom;
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.ButtomLine;
|
| | | frame.AddChidren(btnLine);
|
| | | //联动线的状态
|
| | | txtValue.btnLine = btnLine;
|
| | |
|
| | | if (string.IsNullOrEmpty(UserCenterResourse.UserInfo.Email) == false)
|
| | | if (string.IsNullOrEmpty(HdlUserCenterResourse.UserInfo.UserEmail) == false)
|
| | | {
|
| | | //确认身份成功,请绑定新邮箱
|
| | | var btnMsg1 = new NormalViewControl(800, 49, false);
|
| | |
| | | };
|
| | | btnCodeControl.FinishInputEvent += (value) =>
|
| | | {
|
| | | //校验验证码
|
| | | if (this.CheckVerificationCode(value) == false)
|
| | | {
|
| | | //清空验证码
|
| | | btnCodeControl.ClearInputValue();
|
| | | }
|
| | | //绑定新邮箱
|
| | | this.SaveNewEmail(btnCodeControl, value);
|
| | | };
|
| | |
|
| | | //验证码错误,请重新输入
|
| | |
| | | /// </summary>
|
| | | private void SendCodeToEmail(BottomClickButton btnNext, string Email)
|
| | | {
|
| | | var sendCodePra = new SendCodePra();
|
| | | sendCodePra.Account = Email;
|
| | |
|
| | | bool falge = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/RegisterSendVerCode", false, sendCodePra);
|
| | | if (falge == false)
|
| | | var errorMsg = HdlAccountLogic.Current.SendVeriCodeToEmail(Email, VerCodeType.A绑定);
|
| | | if (errorMsg != null)
|
| | | {
|
| | | //显示错误
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.Text = errorMsg;
|
| | | return;
|
| | | }
|
| | |
|
| | | //不能再发送验证码
|
| | | this.canSendCode = false;
|
| | | //可以开始校验验证码了
|
| | | this.canCheckCode = true;
|
| | | //记录起这个邮箱,防止恶意变更
|
| | |
| | |
|
| | | HdlThreadLogic.Current.RunThread(() =>
|
| | | {
|
| | | while (this.Parent != null)
|
| | | while (this.Parent != null && this.canSendCode == false)
|
| | | {
|
| | | waitime--;
|
| | | System.Threading.Thread.Sleep(1000);
|
| | | if (waitime == 0)
|
| | | {
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnNext.CanClick = true;
|
| | | }
|
| | | });
|
| | | break;
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | |
| | | }
|
| | | }, ShowErrorMode.NO);
|
| | | }
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (btnNext != null)
|
| | | {
|
| | | //获取验证码
|
| | | btnNext.TextID = R.MyInternationalizationString.uGetVerificationCode;
|
| | | //按键可以按下
|
| | | btnNext.CanClick = true;
|
| | | }
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 校验验证码_________________________
|
| | | #region ■ 变更邮箱___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 验证验证码
|
| | | /// 变更邮箱
|
| | | /// </summary>
|
| | | /// <returns></returns>
|
| | | private bool CheckVerificationCode(string code)
|
| | | private void SaveNewEmail(VerificationCodeControl btnCodeControl, string code)
|
| | | {
|
| | | if (this.canCheckCode == false)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | return false;
|
| | | //清空输入值
|
| | | btnCodeControl.ClearInputValue();
|
| | | return;
|
| | | }
|
| | | var checkCodePra = new CheckCodePra();
|
| | | checkCodePra.Code = code;
|
| | | checkCodePra.Account = newEmail;
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/ValidatorCode", false, checkCodePra);
|
| | | if (flage == false)
|
| | | //执行绑定
|
| | | var errorMsg = HdlAccountLogic.Current.BindAccount(this.newEmail, code);
|
| | | if (errorMsg != null)
|
| | | {
|
| | | //验证码错误,请重新输入
|
| | | this.btnErrorMsg.Visible = true;
|
| | | this.btnErrorMsg.TextID = R.MyInternationalizationString.uVerificationCodeErrorInputAgain;
|
| | | return false;
|
| | | }
|
| | |
|
| | | //变更邮箱
|
| | | this.SaveNewEmail();
|
| | | return true;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 变更邮箱
|
| | | /// </summary>
|
| | | private void SaveNewEmail()
|
| | | {
|
| | | var pra = new SaveNewEmailPra();
|
| | | pra.Account = this.newEmail;
|
| | |
|
| | | bool flage = UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/BindAccount", false, pra);
|
| | | if (flage == false)
|
| | | {
|
| | | //绑定邮箱失败
|
| | | this.ShowMassage(ShowMsgType.Tip, Language.StringByID(R.MyInternationalizationString.uBindEmailFail));
|
| | | this.ShowMassage(ShowMsgType.Tip, errorMsg);
|
| | | //可以重新发送验证码
|
| | | this.canSendCode = true;
|
| | | return;
|
| | | }
|
| | |
|
| | |
| | | private void RefreshUserInfoForm()
|
| | | {
|
| | | //如果修改的是账号的话,则重新登录
|
| | | if (UserCenterResourse.UserInfo.Email == Shared.Common.Config.Instance.Account)
|
| | | if (HdlUserCenterResourse.UserInfo.UserEmail == Shared.Common.Config.Instance.Account)
|
| | | {
|
| | | UserCenterLogic.ReLoginAgain(this.newEmail);
|
| | | HdlAccountLogic.Current.ReLoginAgain(this.newEmail);
|
| | | return;
|
| | | }
|
| | |
|
| | | UserCenterResourse.UserInfo.Email = this.newEmail;
|
| | | HdlUserCenterResourse.UserInfo.UserEmail = this.newEmail;
|
| | | this.CloseForm();
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | return true;
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码的启动参数
|
| | | /// </summary>
|
| | | private class SendCodePra
|
| | | {
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | public string Account = string.Empty;
|
| | | /// <summary>
|
| | | /// 公司编号,国内使用手机短信验证码时,此字段填入0,国外手机短信验证码,此字段填入4 |
| | | /// </summary>
|
| | | public int Company = Common.CommonPage.PhoneZoneStr == "86" ? 0 : 4;
|
| | | /// <summary>
|
| | | /// 语言
|
| | | /// </summary>
|
| | | public string Language = Shared.Language.CurrentLanguage;
|
| | | /// <summary>
|
| | | /// 国家地区代码,手机号发送验证码时使用
|
| | | /// </summary>
|
| | | public int AreaCode = 0;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 发送验证码的启动参数
|
| | | /// </summary>
|
| | | private class CheckCodePra
|
| | | {
|
| | | /// <summary>
|
| | | /// 用户账号
|
| | | /// </summary>
|
| | | public string Account = string.Empty;
|
| | | /// <summary>
|
| | | /// 验证码
|
| | | /// </summary>
|
| | | public string Code = "0";
|
| | | /// <summary>
|
| | | /// 语言
|
| | | /// </summary>
|
| | | public string Language = Shared.Language.CurrentLanguage;
|
| | | /// <summary>
|
| | | /// 国家地区代码,手机号发送验证码时使用
|
| | | /// </summary>
|
| | | public int AreaCode = 0;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 保存新邮箱的启动参数
|
| | | /// </summary>
|
| | | private class SaveNewEmailPra
|
| | | {
|
| | | /// <summary>
|
| | | /// 新用户账号
|
| | | /// </summary>
|
| | | public string Account = string.Empty;
|
| | | }
|
| | |
|
| | | #endregion
|