From eb424d24e39bab4a245725f35deab3f234ea0f13 Mon Sep 17 00:00:00 2001
From: gxc <guoxuecheng@guoxuechengdeMacBook-Pro.local>
Date: 星期五, 13 十二月 2019 10:48:50 +0800
Subject: [PATCH] 2019.12.13

---
 ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs |   52 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
old mode 100755
new mode 100644
index 78a13f4..fd7b59a
--- a/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Account/AccountLoginByCode.cs
@@ -87,6 +87,7 @@
         /// </summary>
         public AccountLoginByCode()
         {
+            CommonPage.Instance.IsDrawerLockMode = true;
             Tag = "Login";
             BackgroundColor = ZigbeeColor.Current.GXCBackgroundColor;
             t = new Timer();
@@ -305,14 +306,12 @@
                         var responseDataObj = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.UserLoginRes>(requestRevetLoginCodeOBJ.ResponseData.ToString());
                         var revertData = responseDataObj;
                         Config.ReFresh();
+                        Config.Instance.Password = string.Empty;
                         Config.Instance.Account = revertData.Account;
-                        Config.Instance.MqttKey = revertData.MqttKey;
                         Config.Instance.Guid = revertData.Guid;
                         Config.Instance.MD5PWD = revertData.MD5PWD;
                         Config.Instance.LoginDateTime = DateTime.Now;
-                        Config.Instance.ConnectZigbeeMqttBrokerPwd = revertData.ConnectZigbeeMqttBrokerPwd;
-                        Config.Instance.ConnectZigbeeMqttClientId = revertData.ConnectZigbeeMqttClientId;
-                        Config.Instance.ZigbeeMqttBrokerLoadSubDomain = revertData.ZigbeeMqttBrokerLoadSubDomain;
+                        Config.Instance.LoginToken = revertData.Token;
                         if (Config.Instance.AccountList.Find((obj) => obj == revertData.Account) == null)
                         {
                             Config.Instance.AccountList.Add(revertData.Account);
@@ -434,7 +433,8 @@
         private void AddPhoneOrEmailFL(FrameLayout accountCodeFrameLayout, string phoneOrEmail)
         {
             accountCodeFrameLayout.RemoveAll();
-
+            account = string.Empty;
+            loginErrorBtn.Text = string.Empty;
             if (phoneOrEmail == "Phone")
             {
                 phoneRow = new PhoneRowForm();
@@ -463,11 +463,12 @@
         /// <param name="mouseEventArgs">The ${ParameterType} instance containing the event data.</param>
         private void Account_TextChange(object sender, string mouseEventArgs)
         {
-            loginErrorBtn.Text = "";
+            loginErrorBtn.Text = string.Empty;
             if ((sender as EditText).Text.Trim().Length > 0)
             {
                 IsRightAccount = true;
                 codeRow.SendCodeBtn.Enable = codeRow.SendCodeBtn.IsSelected = true;
+                account= (sender as EditText).Text.Trim();
             }
             else
             {
@@ -542,9 +543,9 @@
         private void Register(object sender, MouseEventArgs mouseEventArgs)
         {
             this.RemoveFromParent();
-            var login = new AccountLogin();
-            CommonPage.Instance.AddChidren(login);
-            login.Show();
+            var registerPage = new AccountRegister();
+            CommonPage.Instance.AddChidren(registerPage);
+            registerPage.Show();
         }
 
         #endregion
@@ -571,6 +572,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
@@ -639,6 +645,34 @@
                 CommonPage.Loading.Hide();
             }
         }
+
+        /// <summary>
+        /// CheckAccount
+        /// </summary>
+        /// <param name="accountStr"></param>
+        /// <returns></returns>
+        private bool CheckAccount(string accountStr)
+        {
+            loginErrorBtn.Text = string.Empty;
+            if (phoneEmailForm.SelectedEmail.IsSelected)
+            {
+                if (AccountLogic.Instance.CheckEmail(accountStr) == false)
+                {
+                    loginErrorBtn.TextID = R.MyInternationalizationString.TheEmailError;
+                    return false;
+                }
+            }
+            else
+            {
+                if (AccountLogic.Instance.CheckPhoneWithZone(accountStr, CommonPage.PhoneZoneStr) == false)
+                {
+                    loginErrorBtn.TextID = R.MyInternationalizationString.ThePhoneError;
+                    return false;
+                }
+            }
+            return true;
+        }
+
         #endregion
 
         #region 鈼� 楠岃瘉楠岃瘉鐮乢_______________________

--
Gitblit v1.8.0