Browse Source

1.4.7 登陆限制账号密码长度、限制账号输入中文特殊符号等。

tags/录制修改前
zhangxueyang 3 years ago
parent
commit
010e6c9755

+ 2
- 2
XHWK.WKTool/App.config View File

32
     <!--上传每片大小 Mb-->
32
     <!--上传每片大小 Mb-->
33
     <add key="UploadSliceLen" value="1" />
33
     <add key="UploadSliceLen" value="1" />
34
     <!--版本号-->
34
     <!--版本号-->
35
-    <add key="VersionCode" value="47" />
36
-    <add key="VersionName" value="1.4.6" />
35
+    <add key="VersionCode" value="48" />
36
+    <add key="VersionName" value="1.4.7" />
37
     <add key="ClientSettingsProvider.ServiceUri" value="" />
37
     <add key="ClientSettingsProvider.ServiceUri" value="" />
38
   </appSettings>
38
   </appSettings>
39
   <system.web>
39
   <system.web>

+ 1
- 1
XHWK.WKTool/LoginWindow.xaml View File

93
             <TextBlock Text="登陆" FontSize="18" Padding="2,15,10,0"/>
93
             <TextBlock Text="登陆" FontSize="18" Padding="2,15,10,0"/>
94
             <!--输入框-->
94
             <!--输入框-->
95
             <Border Background="#cccbce" Width="344" Height="43" CornerRadius="3" Margin="0,0,0,1">
95
             <Border Background="#cccbce" Width="344" Height="43" CornerRadius="3" Margin="0,0,0,1">
96
-                <TextBox x:Name="txbAccountNumber" Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="342" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
96
+                <TextBox x:Name="txbAccountNumber" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="txbAccountNumber_PreviewTextInput"  Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="342" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
97
             </Border>
97
             </Border>
98
         </StackPanel>
98
         </StackPanel>
99
         <!--第三行 密码-->
99
         <!--第三行 密码-->

+ 41
- 1
XHWK.WKTool/LoginWindow.xaml.cs View File

3
 using System;
3
 using System;
4
 using System.Configuration;
4
 using System.Configuration;
5
 using System.Text;
5
 using System.Text;
6
+using System.Text.RegularExpressions;
6
 using System.Windows;
7
 using System.Windows;
7
-
8
+using System.Windows.Input;
8
 using XHWK.WKTool.DAL;
9
 using XHWK.WKTool.DAL;
9
 
10
 
10
 namespace XHWK.WKTool
11
 namespace XHWK.WKTool
64
                 MessageWindow.Show("账号未输入");
65
                 MessageWindow.Show("账号未输入");
65
                 return;
66
                 return;
66
             }
67
             }
68
+            if(txbAccountNumber.Text.Length>16)
69
+            {
70
+                MessageWindow.Show("账号长度不能高于16位");
71
+                return;
72
+            }
67
             if (string.IsNullOrEmpty(pobPassword.Password))
73
             if (string.IsNullOrEmpty(pobPassword.Password))
68
             {
74
             {
69
                 MessageWindow.Show("密码未输入");
75
                 MessageWindow.Show("密码未输入");
70
                 return;
76
                 return;
71
             }
77
             }
78
+            if (pobPassword.Password.Length > 16)
79
+            {
80
+                MessageWindow.Show("密码长度不能高于16位");
81
+                return;
82
+            }
72
             APP.myloading.Show();
83
             APP.myloading.Show();
73
             Login();
84
             Login();
74
         }
85
         }
188
             config.Save(ConfigurationSaveMode.Modified);
199
             config.Save(ConfigurationSaveMode.Modified);
189
             ConfigurationManager.RefreshSection("appSettings");
200
             ConfigurationManager.RefreshSection("appSettings");
190
         }
201
         }
202
+        /// <summary>
203
+        /// 限制输入特殊字符
204
+        /// </summary>
205
+        /// <param name="sender"></param>
206
+        /// <param name="e"></param>
207
+        private void txbAccountNumber_PreviewTextInput(object sender, TextCompositionEventArgs e)
208
+        {
209
+            try
210
+            {
211
+                Regex re = new Regex("[^0-9\\-]+");
212
+                Regex re1 = new Regex("[^A-Za-z\\-]+");
213
+                if (!re.IsMatch(e.Text))
214
+                {
215
+                    e.Handled = re.IsMatch(e.Text);
216
+                }
217
+                else if (!re1.IsMatch(e.Text))
218
+                {
219
+                    e.Handled = re1.IsMatch(e.Text);
220
+                }
221
+                else
222
+                {
223
+                    e.Handled = true;
224
+                }
225
+
226
+            }
227
+            catch (Exception ex)
228
+            {
229
+            }
230
+        }
191
     }
231
     }
192
 }
232
 }

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50
 //通过使用 "*",如下所示:
50
 //通过使用 "*",如下所示:
51
 // [assembly: AssemblyVersion("1.0.*")]
51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.4.6.0")]
53
-[assembly: AssemblyFileVersion("1.4.6.0")]
52
+[assembly: AssemblyVersion("1.4.7.0")]
53
+[assembly: AssemblyFileVersion("1.4.7.0")]

Loading…
Cancel
Save