private void UILoginButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(UIUserName.Text)) { MessageBox.Show("Tên đăng nhập không được để trống!"); return; } if (string.IsNullOrEmpty(UIPassword.Password)) { MessageBox.Show("Mật khẩu không được để trống!"); return; } int result = LoginData(UIUserName.Text, FunctionStatics.MD5String(UIPassword.Password)); if (result == 0) { MessageBox.Show("Tên đăng nhập hoặc mật khẩu không khớp nhau!"); return; } else { App.curUserID = result; MessageBox.Show("Đăng nhập thành công!"); Application.Current.MainWindow = new MainWindow(); Application.Current.MainWindow.Show(); if (App.cache.autoLogin) { App.cache.hashUserName = App.getHash(result); AltaCache.Write(App.CacheName, App.cache); } this.Close(); } }
private void UIBtn_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (this.UIUser.isEmpty()) { UIWaring.Text = "* Tên đăng nhập không được để trống!"; return; } if (this.UIPass.Password == "") { UIWaring.Text = "* Mật khẩu không được để trống!"; return; } string hash = (this.UIUser.Text + FunctionStatics.getCPUID() + this.UIPass.Password.toMD5()).toMD5(); User u = App.DataUser.Login(hash); if (u == null) { UIWaring.Text = "* Tên đăng nhập hoặc mật khẩu không đúng!"; return; } UIWaring.Text = string.Empty; App.User = u; Application.Current.MainWindow = new MainWindow(); Application.Current.MainWindow.Show(); this.Close(); }
public bool Login(string hash) { string _hash = (this.user_name + FunctionStatics.getCPUID() + this.Pass).toMD5(); if (_hash == hash) { return(true); } return(false); }
private void Button_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(this.UITxtName.Text)) { this.UIErr.Text = "* Tên đăng nhập không được để trống!"; this.UIErr.Animation_Opacity_View_Frame(true); return; } if (this.UIErr.Visibility == System.Windows.Visibility.Visible && this.UIErr.Opacity != 0) { this.UIErr.Animation_Opacity_View_Frame(false); } if (string.IsNullOrEmpty(UIPassword.Password)) { this.UIErPass.Animation_Opacity_View_Frame(true); return; } if (this.UIErPass.Visibility == System.Windows.Visibility.Visible && this.UIErPass.Opacity != 0) { this.UIErPass.Animation_Opacity_View_Frame(false); } int result = LoginData(UITxtName.Text, FunctionStatics.MD5String(UIPassword.Password)); if (result == 0) { this.UIErr.Text = "* Tên đăng nhập hoặc mật khẩu không đúng!"; this.UIErr.Animation_Opacity_View_Frame(true); return; } else { this.UIErr.Text = string.Empty; this.UIErr.Animation_Opacity_View_Frame(false); App.curUserID = result; App.curUser = UserData.Info(App.curUserID); if (this.UIAutoLogin.IsChecked.Value) { App.cache.hashUserName = App.getHash(result); App.cache.userName = Encrypt.EncryptString(this.UITxtName.Text.Trim(), FunctionStatics.getCPUID()); AltaCache.Write(App.CacheName, App.cache); } else { App.cache.userName = string.Empty; App.cache.hashUserName = string.Empty; } this.UIFullName.Text = App.curUser.Full_Name; this.UILoginForm.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); }); } }
private void ReLogin_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrEmpty(UIPassword_off.Password)) { this.UIErrRelogin.Text = "* Mật khẩu đăng nhập không được để trống!"; this.UIErrRelogin.Animation_Opacity_View_Frame(true); return; } int result = LoginData(this.cacheName, FunctionStatics.MD5String(UIPassword_off.Password)); if (result == 0) { this.UIErrRelogin.Text = "* Mật khẩu đăng nhập không đúng!"; this.UIErrRelogin.Animation_Opacity_View_Frame(true); return; } else { App.curUserID = result; App.curUser = UserData.Info(App.curUserID); if (App.cache.autoLogin) { App.cache.hashUserName = App.getHash(result); App.cache.userName = Encrypt.EncryptString(this.UITxtName.Text.Trim(), FunctionStatics.getCPUID()); AltaCache.Write(App.CacheName, App.cache); } else { App.cache.userName = string.Empty; App.cache.hashUserName = string.Empty; } this.UIAvatar.Text = App.curUser.Full_Name[0].ToString(); this.UIFullName.Text = App.curUser.Full_Name; this.UILoginLogOff.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); }); } }
public void Verify(DPFP.Sample Sample) { DPFP.FeatureSet features = ExtractFeatures(Sample, DPFP.Processing.DataPurpose.Verification); // Check quality of the sample and start verification if it's good // TODO: move to a separate task if (features != null) { // Compare the feature set with our template DPFP.Verification.Verification.Result result = new DPFP.Verification.Verification.Result(); Verificator.Verify(features, Template, ref result); if (result.Verified) { this.Dispatcher.Invoke(() => { if (this.ClockShow != null) { this.ClockShow.Controller.Pause(); } ColorAnimation animation = new ColorAnimation(); animation.From = (this.UIFinger_Printer.Foreground as SolidColorBrush).Color; animation.To = Colors.Green; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { Power = 5, EasingMode = EasingMode.EaseInOut }; animation.Completed += (s, e) => { App.curUser = UserData.Info(this.cacheName); App.curUserID = App.curUser.ID; if (this.UIAutoLogin.IsChecked.Value) { App.cache.hashUserName = App.getHash(App.curUserID); App.cache.userName = Encrypt.EncryptString(this.UITxtName.Text.Trim(), FunctionStatics.getCPUID()); AltaCache.Write(App.CacheName, App.cache); } else { App.cache.userName = string.Empty; App.cache.hashUserName = string.Empty; } this.UIFullName.Text = App.curUser.Full_Name; this.UILoginFinger.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); }); }; this.ClockHide = animation.CreateClock(); this.UIFinger_Printer.Foreground.ApplyAnimationClock(SolidColorBrush.ColorProperty, ClockHide); this.UIFinger_Status.Text = string.Empty; }); this.Stop(); } else { this.Dispatcher.Invoke(() => { this.UIFinger_Status.Text = "Try again ..."; }); } } }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (App.cache.autoLogin) { this.UIAutoLogin.IsChecked = true; } //if (App.curUserID > 0) //{ // if (App.curUser == null) // { // App.curUser = UserData.Info(App.curUserID); // this.UIAvatar.Text = App.curUser.Full_Name[0].ToString().ToUpper(); // this.UIFullName.Text = App.curUser.Full_Name; // this.UILoginSusscess.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500, () => { LoadData(); }); // } // else // { // this.UIFullName_off.Text = App.curUser.Full_Name; // this.UILoginLogOff.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500); // } // this.UILoginForm.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); //} if (!string.IsNullOrEmpty(this.cacheName)) { if (this.Template != null) { this.UIFullName_Finger.Text = UserData.getFullName(cacheName); this.UILoginFinger.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500); this.Start(); } else { this.UIFullName_off.Text = UserData.getFullName(cacheName); this.UILoginLogOff.Animation_Translate_Frame(-400, double.NaN, 0, double.NaN, 500); } this.UILoginForm.Animation_Translate_Frame(double.NaN, double.NaN, 400, double.NaN, 500); } if (!string.IsNullOrEmpty(App.cache.userName)) { this.UITxtName.Text = Encrypt.DecryptString(App.cache.userName, FunctionStatics.getCPUID()); this.UIMaskUserName.Animation_Opacity_View_Frame(false, null, 200); } this.UIFinger_Status.Text = string.Empty; this.UIFinger_Status.Foreground = new SolidColorBrush(Colors.White); ColorAnimation animation = new ColorAnimation(); animation.From = Colors.Black; animation.To = Colors.OrangeRed; animation.AutoReverse = true; animation.Duration = new Duration(TimeSpan.FromMilliseconds(450)); animation.EasingFunction = new PowerEase() { EasingMode = EasingMode.EaseInOut, Power = 3 }; animation.RepeatBehavior = RepeatBehavior.Forever; this.UIFinger_Status.Foreground.BeginAnimation(SolidColorBrush.ColorProperty, animation); }