From e2cd94abacc0101af8d0db7fed3a785c1a045b5d Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期四, 07 五月 2020 09:28:51 +0800
Subject: [PATCH] 上传
---
ZigbeeApp/Shared/Phone/UserCenter/Password/EditorSecondaryPasswordForm.cs | 144 +++++++++++++++++++++++++++++++-----------------
1 files changed, 93 insertions(+), 51 deletions(-)
diff --git a/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorSecondaryPasswordForm.cs b/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorSecondaryPasswordForm.cs
index 4486590..c2f91ae 100755
--- a/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorSecondaryPasswordForm.cs
+++ b/ZigbeeApp/Shared/Phone/UserCenter/Password/EditorSecondaryPasswordForm.cs
@@ -32,7 +32,7 @@
//璁剧疆澶撮儴淇℃伅
base.SetTitleText(Language.StringByID(R.MyInternationalizationString.uPasswordAuthentication));
- if (string.IsNullOrEmpty(UserCenterResourse.Option.PswAuthentication) == false)
+ if (string.IsNullOrEmpty(UserCenterResourse.AccountOption.PswAuthentication) == false)
{
formMode = FormMode.A楠岃瘉鍓嶅洖瀵嗙爜;
}
@@ -49,53 +49,41 @@
//娓呯┖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.SecureTextEntry = true;
- 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楠岃瘉鍓嶅洖瀵嗙爜)
@@ -114,7 +102,7 @@
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;
@@ -131,8 +119,8 @@
/// 鏍¢獙瀵嗙爜
/// </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鏂板缓瀵嗙爜)
{
@@ -146,29 +134,43 @@
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纭淇敼瀵嗙爜;
@@ -179,14 +181,11 @@
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);
}
}
@@ -205,6 +204,49 @@
#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>
--
Gitblit v1.8.0