登录界面要求如下:
1、如何保证密码的安全性。
2、如何进行密码验证。
3、如何当密码输错三次,用户自动锁定。
4、如何提示用户。
问题解决方案:
1、采用MD5加密,再进行加盐处理。
2、输入的密码加密,与数据库中的密码相匹配。
3、设置全局变量进行计算密码输入错误次数。
4、密码错误与用户名不存在时,在界面上显示错误信息,而不是弹出窗口。
登录前台代码XAML:
<Window x:Class="HRMS.UI.LoginWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="人事管理系统" Height="250" Width="300"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen" Loaded="Window_Loaded_1"
WindowStyle="None"
AllowsTransparency="True"
Background="Transparent"
>
<Grid >
<Grid.Background>
<ImageBrush ImageSource="Images/Login.png"></ImageBrush>
</Grid.Background>
<TextBox x:Name="txtUserName" HorizontalAlignment="Left" Height="23" Margin="116,73,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="140" Text="admin"/>
<PasswordBox x:Name="pwdPassword" HorizontalAlignment="Left" Height="23" Margin="116,125,0,0" VerticalAlignment="Top" Width="140" Password="123"/>
<Te