| | |
| | | //设置头部信息
|
| | | base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPasswordAuthentication));
|
| | |
|
| | | if (string.IsNullOrEmpty(UserCenterResourse.Option.PswAuthentication) == false)
|
| | | if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == false)
|
| | | {
|
| | | formMode = FormMode.A验证前回密码;
|
| | | }
|
| | |
| | | //清空bodyFrame
|
| | | this.ClearBodyFrame();
|
| | |
|
| | | var btnMsg = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(49), false);
|
| | | btnMsg.Y = Application.GetRealHeight(311);
|
| | | btnMsg.TextAlignment = TextAlignment.Center;
|
| | | btnMsg.TextSize = 12;
|
| | | bodyFrameLayout.AddChidren(btnMsg);
|
| | | if (formMode == FormMode.A新建密码
|
| | | || formMode == FormMode.A验证前回密码)
|
| | | string title = string.Empty;
|
| | | if (formMode == FormMode.A新建密码)
|
| | | {
|
| | | //请输入新密码
|
| | | title = Language.StringByID(R.MyInternationalizationString.uPleaseInputNewPassword);
|
| | | }
|
| | | else if (formMode == FormMode.A验证前回密码)
|
| | | {
|
| | | //请输入密码
|
| | | btnMsg.TextID = R.MyInternationalizationString.uPleaseInputPsw;
|
| | | title = Language.StringByID(R.MyInternationalizationString.uPleaseInputPsw);
|
| | | }
|
| | | else if (formMode == FormMode.A确认新建密码
|
| | | || formMode == FormMode.A确认修改密码)
|
| | | {
|
| | | //请再次确认密码
|
| | | btnMsg.TextID = R.MyInternationalizationString.uPleaseConfirmPswAgain;
|
| | | title = Language.StringByID(R.MyInternationalizationString.uPleaseConfirmPswAgain);
|
| | | }
|
| | | else if (formMode == FormMode.A修改密码)
|
| | | {
|
| | | //修改密码,请输入新密码
|
| | | btnMsg.TextID = R.MyInternationalizationString.uEditorPswPleaseInputNewPsw;
|
| | | title = Language.StringByID(R.MyInternationalizationString.uEditorPswPleaseInputNewPsw);
|
| | | }
|
| | |
|
| | | //错误信息
|
| | | var msgControl = new NormalViewControl(bodyFrameLayout.Width, Application.GetRealHeight(58), false);
|
| | | msgControl.Y = Application.GetRealHeight(660);
|
| | | msgControl.TextAlignment = TextAlignment.Center;
|
| | | msgControl.TextColor = 0xfff75858;
|
| | | bodyFrameLayout.AddChidren(msgControl);
|
| | |
|
| | | //初始化验证码控件
|
| | | var btnCodeControl = new VerificationCodeControl(4);
|
| | | btnCodeControl.Y = Application.GetRealHeight(464);
|
| | | bodyFrameLayout.AddChidren(btnCodeControl);
|
| | | btnCodeControl.InitControl();;
|
| | | btnCodeControl.TxtCodeChangeEvent += (sender, e) =>
|
| | | {
|
| | | if (msgControl.Visible == true)
|
| | | {
|
| | | msgControl.Visible = false;
|
| | | }
|
| | | };
|
| | | btnCodeControl.FinishInputEvent += (value) =>
|
| | | //密码控件
|
| | | var pswControl = new PswNumberInputControl(title);
|
| | | //变更数字表盘背景色
|
| | | pswControl.NumberIconBackColor = UserCenterColor.Current.White;
|
| | | pswControl.Y = Application.GetRealHeight(104);
|
| | | pswControl.Gravity = Gravity.CenterHorizontal;
|
| | | bodyFrameLayout.AddChidren(pswControl);
|
| | | pswControl.InitControl();
|
| | | pswControl.FinishInputEvent += (password) =>
|
| | | {
|
| | | //校验密码
|
| | | this.DoAdjustPssword(value, msgControl);
|
| | | this.DoAdjustPssword(password, pswControl);
|
| | | };
|
| | |
|
| | | if (formMode == FormMode.A验证前回密码)
|
| | |
| | | form.AddForm();
|
| | | };
|
| | | //底线
|
| | | int lineWidth = btnForgotPsw.GetRealWidthByText(12);
|
| | | int lineWidth = btnForgotPsw.GetRealWidthByText();
|
| | | var btnLine = new NormalViewControl(lineWidth, ControlCommonResourse.BottomLineHeight, false);
|
| | | btnLine.BackgroundColor = UserCenterColor.Current.TextOrangeColor;
|
| | | btnLine.Gravity = Gravity.CenterHorizontal;
|
| | |
| | | /// 校验密码
|
| | | /// </summary>
|
| | | /// <param name="i_Psw"></param>
|
| | | /// <param name="msgControl"></param>
|
| | | private void DoAdjustPssword(string i_Psw, NormalViewControl msgControl)
|
| | | /// <param name="pswControl"></param>
|
| | | private void DoAdjustPssword(string i_Psw, PswNumberInputControl pswControl)
|
| | | {
|
| | | if (formMode == FormMode.A新建密码)
|
| | | {
|
| | |
| | | if (this.firstPssword != i_Psw)
|
| | | {
|
| | | //确认密码错误,请重新设置
|
| | | msgControl.Visible = true;
|
| | | msgControl.TextID = R.MyInternationalizationString.SecondPswNotEqual2;
|
| | | pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual2));
|
| | | return;
|
| | | }
|
| | | UserCenterResourse.Option.PswAuthentication = i_Psw;
|
| | | UserCenterResourse.Option.Save();
|
| | | //关闭界面
|
| | | this.CloseForm();
|
| | | //保存密码
|
| | | this.SaveSecondaryPassword(pswControl, i_Psw);
|
| | | }
|
| | | else if (formMode == FormMode.A验证前回密码)
|
| | | {
|
| | | if (UserCenterResourse.Option.PswAuthentication != i_Psw)
|
| | | if (UserCenterResourse.AccountOption.PswAuthentication != i_Psw)
|
| | | {
|
| | | UserCenterResourse.AccountOption.PasswordInputCount--;
|
| | | if (UserCenterResourse.AccountOption.PasswordInputCount <= 0)
|
| | | {
|
| | | //管理员身份验证失败,请重新登录
|
| | | string msg2 = Language.StringByID(R.MyInternationalizationString.uCheckAdministratorFailAndReload);
|
| | | this.ShowMassage(ShowMsgType.Tip, msg2);
|
| | | UserCenterLogic.ReLoginAgain(Common.Config.Instance.Account);
|
| | | return;
|
| | | }
|
| | | //密码错误,请重新输入
|
| | | msgControl.Visible = true;
|
| | | msgControl.TextID = R.MyInternationalizationString.uOldPsswordIsError;
|
| | | pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uOldPsswordIsError));
|
| | | return;
|
| | | }
|
| | | //重置剩余密码次数
|
| | | UserCenterResourse.AccountOption.ResetPasswordCount();
|
| | |
|
| | | formMode = FormMode.A修改密码;
|
| | | this.InitMiddleFrame();
|
| | | }
|
| | | else if (formMode == FormMode.A修改密码)
|
| | | {
|
| | | if (i_Psw == UserCenterResourse.AccountOption.PswAuthentication)
|
| | | {
|
| | | //新密码和原密码一致,请重新输入
|
| | | pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.uNewPswAndOldPswIsEqual));
|
| | | return;
|
| | | }
|
| | | //输入二次密码
|
| | | this.firstPssword = i_Psw;
|
| | | formMode = FormMode.A确认修改密码;
|
| | |
| | | if (this.firstPssword != i_Psw)
|
| | | {
|
| | | //确认密码错误,请重新设置
|
| | | msgControl.Visible = true;
|
| | | msgControl.TextID = R.MyInternationalizationString.SecondPswNotEqual2;
|
| | | pswControl.SetErrorMsg(Language.StringByID(R.MyInternationalizationString.SecondPswNotEqual2));
|
| | | return;
|
| | | }
|
| | | UserCenterResourse.Option.PswAuthentication = i_Psw;
|
| | | UserCenterResourse.Option.Save();
|
| | | //关闭界面
|
| | | this.CloseForm();
|
| | | //保存密码
|
| | | this.SaveSecondaryPassword(pswControl, i_Psw);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 保存密码___________________________
|
| | |
|
| | | /// <summary>
|
| | | /// 保存密码
|
| | | /// </summary>
|
| | | /// <param name="contr">控件</param>
|
| | | /// <param name="psw">密码</param>
|
| | | private void SaveSecondaryPassword(PswNumberInputControl contr, string psw)
|
| | | {
|
| | | HdlThreadLogic.Current.RunThread(async () =>
|
| | | {
|
| | | //打开进度条
|
| | | this.ShowProgressBar();
|
| | | var pra = new
|
| | | {
|
| | | RequestVersion = Common.CommonPage.RequestVersion,
|
| | | LoginAccessToken = Common.Config.Instance.Token,
|
| | | GesturePwd = UserCenterResourse.AccountOption.GestureAuthentication,
|
| | | StringPwd = psw
|
| | | };
|
| | | var result = await UserCenterLogic.GetResultStatuByRequestHttps("ZigbeeUsers/UpdatEexpandPwd", false, pra);
|
| | | //关闭进度条
|
| | | this.CloseProgressBar();
|
| | |
|
| | | HdlThreadLogic.Current.RunMain(() =>
|
| | | {
|
| | | if (result == false)
|
| | | {
|
| | | contr.SetErrorMsg(string.Empty);
|
| | | }
|
| | | else
|
| | | {
|
| | | UserCenterResourse.AccountOption.PswAuthentication = psw;
|
| | | UserCenterResourse.AccountOption.Save();
|
| | | //界面关闭
|
| | | this.CloseForm();
|
| | | }
|
| | | });
|
| | | });
|
| | | }
|
| | |
|
| | | #endregion
|
| | |
|
| | | #region ■ 结构体_____________________________
|
| | |
|
| | | /// <summary>
|