From 66a9965c44ecc32a6696abca876ab9d1cd091584 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 28 二月 2020 15:25:13 +0800
Subject: [PATCH] 2020.2.28

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs |   89 ++++++++++++++++++++++++++++++++++++--------
 1 files changed, 73 insertions(+), 16 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs
old mode 100755
new mode 100644
index 60a77c2..ae8adc4
--- a/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountForgetPWD.cs
@@ -61,6 +61,7 @@
         /// </summary>
         public AccountForgetPWD()
         {
+            CommonPage.Instance.IsDrawerLockMode = true;
             BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
             Tag = "Forgot";
         }
@@ -123,7 +124,7 @@
                 Width = Application.GetRealWidth(942),
                 Gravity = Gravity.CenterHorizontal,
                 BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor,
-                Radius = (uint)Application.GetRealHeight(30)
+                Radius = (uint)Application.GetRealHeight(17)
             };
             bodyFrameLayout.AddChidren(accountCodeFL);
 
@@ -138,6 +139,8 @@
                 Height = Application.GetRealHeight(58),
                 TextColor = ZigbeeColor.Current.GXCTextRed,
                 TextAlignment = TextAlignment.CenterLeft,
+                TextSize = CommonFormResouce.TextSize,
+                IsBold = true
             };
             bodyFrameLayout.AddChidren(errorBtn);
 
@@ -154,7 +157,9 @@
                 BackgroundColor = ZigbeeColor.Current.GXCButtonUnSelectedColor,
                 Radius = (uint)Application.GetRealHeight(127 / 2),
                 Enable = !string.IsNullOrEmpty(codeRow.VerificationCodeET?.Text),
-                IsSelected = !string.IsNullOrEmpty(codeRow.VerificationCodeET?.Text)
+                IsSelected = !string.IsNullOrEmpty(codeRow.VerificationCodeET?.Text),
+                TextSize = 16,
+                IsBold = true,
             };
             bodyFrameLayout.AddChidren(resetBtn);
         }
@@ -170,8 +175,10 @@
         private void SelectPhoneOrEmail_MouseUpEvent(object sender, MouseEventArgs mouseEventArgs)
         {
             phoneEmailForm.SelectedPhone.IsSelected = phoneEmailForm.SelectedEmail.IsSelected = false;
+            phoneEmailForm.SelectedPhone.IsBold = phoneEmailForm.SelectedEmail.IsBold = false;
             resetBtn.Enable = resetBtn.IsSelected = false;
-            (sender as Button).IsSelected = true;
+            errorBtn.Text = string.Empty;
+            (sender as Button).IsSelected = (sender as Button).IsBold = true;
             if ((sender as Button).Tag.ToString() == "Phone")
             {
                 AddPhoneOrEmailFL(accountCodeFL, "Phone");
@@ -190,7 +197,7 @@
         private void AddPhoneOrEmailFL(FrameLayout accountCodeFrameLayout, string phoneOrEmail)
         {
             accountCodeFrameLayout.RemoveAll();
-
+            account = string.Empty;
             if (phoneOrEmail == "Phone")
             {
                 phoneRow = new PhoneRowForm();
@@ -240,16 +247,17 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void Account_TextChange(object sender, string mouseEventArgs)
         {
-            errorBtn.Text = "";
+            errorBtn.Text = string.Empty;
+            
             if ((sender as EditText).Text.Trim().Length > 0)
             {
                 codeRow.SendCodeBtn.Enable = codeRow.SendCodeBtn.IsSelected = true;
+                account = (sender as EditText).Text.Trim();
             }
             else
             {
                 codeRow.SendCodeBtn.Enable = codeRow.SendCodeBtn.IsSelected = false;
             }
-            account = (sender as EditText).Text.Trim();
         }
 
         /// <summary>
@@ -259,7 +267,7 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void Code_TextChange(object sender, string mouseEventArgs)
         {
-            errorBtn.Text = "";
+            errorBtn.Text = string.Empty;
             if ((sender as EditText).Text.Trim().Length > 0)
             {
                 resetBtn.Enable = resetBtn.IsSelected = true;
@@ -280,6 +288,11 @@
         /// <param name="mouseEventArgs"></param>
         private async void SendCode_MouseUpEventAsync(object sender, MouseEventArgs mouseEventArgs)
         {
+            if (CheckAccount(account) == false)
+            {
+                return;
+            }
+
             (sender as Button).Enable = (sender as Button).IsSelected = false;
             CommonPage.Loading.Start();
             try
@@ -323,10 +336,10 @@
                     errorBtn.TextID = R.MyInternationalizationString.SENDFAIL;
                     (sender as Button).Enable = (sender as Button).IsSelected = true;
                 }
-                else if (stateCodeStr == "EXIST")
+                else if (stateCodeStr == "ACCOUNTNOEXISTS")
                 {
-                    //璐﹀彿瀛樺湪
-                    errorBtn.TextID = R.MyInternationalizationString.AccountHasBeenRegistered;
+                    //璐﹀彿涓嶅瓨鍦�
+                    errorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
                     (sender as Button).Enable = (sender as Button).IsSelected = true;
                 }
                 else
@@ -345,6 +358,35 @@
                 CommonPage.Loading.Hide();
             }
         }
+
+
+        /// <summary>
+        /// CheckAccount
+        /// </summary>
+        /// <param name="accountStr"></param>
+        /// <returns></returns>
+        private bool CheckAccount(string accountStr)
+        {
+            errorBtn.Text = string.Empty;
+            if (phoneEmailForm.SelectedEmail.IsSelected)
+            {
+                if (AccountLogic.Instance.CheckEmail(accountStr) == false)
+                {
+                    errorBtn.TextID = R.MyInternationalizationString.TheEmailError;
+                    return false;
+                }
+            }
+            else
+            {
+                if (AccountLogic.Instance.CheckPhoneWithZone(accountStr, CommonPage.PhoneZoneStr) == false)
+                {
+                    errorBtn.TextID = R.MyInternationalizationString.ThePhoneError;
+                    return false;
+                }
+            }
+            return true;
+        }
+
         #endregion
 
         #region 鈼� 纭淇敼__________________________
@@ -356,13 +398,23 @@
         /// <param name="mouseEventArgs"></param>
         private async void Reset(object sender,MouseEventArgs mouseEventArgs)
         {
+
+            if (CheckAccount(account) == false)
+            {
+                return;
+            }
             //鍏堝垽鏂�2娆″瘑鐮佽緭鍏ユ槸鍚︿竴鑷�
             if (pwdRow.PasswrodET.Text.Trim() != pwdComfireRow.PasswrodET.Text.Trim())
             {
-                var alert = new Alert(Language.StringByID(R.MyInternationalizationString.TIP), Language.StringByID(R.MyInternationalizationString.TwoPasswordInconsistency), Language.StringByID(R.MyInternationalizationString.Confrim));
-                alert.Show();
+                errorBtn.TextID = R.MyInternationalizationString.TwoPasswordInconsistency;
                 return;
             }
+            if (AccountLogic.Instance.CheckPwdLength(pwdRow.PasswrodET.Text.Trim()) == false)
+            {
+                errorBtn.TextID = R.MyInternationalizationString.ThePWDLengthError;
+                return;
+            }
+           
             CommonPage.Loading.Start();
             try
             {
@@ -406,24 +458,24 @@
                     }
                     else if (stateStr == "PARAMETEROREMPTY")
                     {
-                        //鎻愪緵鐨勫弬鏁伴敊璇�
                         errorBtn.TextID = R.MyInternationalizationString.PARAMETEROREMPTY;
                     }
                     else if (stateStr == "ACCOUNTNOEXISTS")
                     {
-                        //璐﹀彿涓嶅瓨鍦�
                         errorBtn.TextID = R.MyInternationalizationString.ACCOUNTNOEXISTS;
                     }
                     else if (stateStr == "FAIL")
                     {
-                        //鎿嶄綔澶辫触
                         errorBtn.TextID = R.MyInternationalizationString.FAIL;
+                    }
+                    else if(stateStr == "NEWPASSWORDANDOLDPASSWORDEQUAL")
+                    {
+                        errorBtn.TextID = R.MyInternationalizationString.NEWPASSWORDANDOLDPASSWORDEQUAL;
                     }
                     else
                     {
                         errorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;
                     }
-
                 }
                 else if (stateCodeStr == "PARAMETEROREMPTY")
                 {
@@ -435,6 +487,11 @@
                     //楠岃瘉鐮侀敊璇�
                     errorBtn.TextID = R.MyInternationalizationString.VALIDCODEANDPHONENOEQUAL;
                 }
+                else if (stateCodeStr == "NORECORD")
+                {
+                    errorBtn.TextID = R.MyInternationalizationString.NORECORD;
+                }
+
                 else
                 {
                     errorBtn.TextID = R.MyInternationalizationString.RequestServerFailed;

--
Gitblit v1.8.0