private void UserPasswordValue_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { //Get all needed information from Form string user_login = this.UserLoginValue.Text; string user_password = this.UserPasswordValue.Password; //TODO: Create DB and process it - return and pass to mainWindow - role, and username SqliteLoginDataSet login_dataset = new SqliteLoginDataSet(); UserLoginTableAdapter user_login_table_adapter = new UserLoginTableAdapter(); user_login_table_adapter.Fill(login_dataset.UserLogin); foreach (DataRow dr in login_dataset.UserLogin.Rows) { if (dr["UserName"].ToString() == user_login) { if (dr["Password"].ToString() == user_password) { loginsuccessfull = true; //sanitize locale string locale = sanitize_locale(this); var prodigy_configtool_window = new FileManager(locale, Convert.ToInt32(dr["Role"]), null); prodigy_configtool_window.Show(); this.Close(); } } } } }
private void UserRepeatNewPasswordValue_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter) { string user_login = this.UserLoginValue.Text; string user_password = this.UserPasswordValue.Password; string new_user_password = this.UserNewPasswordValue.Password; string confirm_new_user_password = this.UserRepeatNewPasswordValue.Password; SqliteLoginDataSet login_dataset = new SqliteLoginDataSet(); UserLoginTableAdapter user_login_table_adapter = new UserLoginTableAdapter(); user_login_table_adapter.Fill(login_dataset.UserLogin); foreach (DataRow dr in login_dataset.UserLogin.Rows) { if (dr["UserName"].ToString() == user_login) { if (dr["Password"].ToString() == user_password) { loginsuccessfull = true; if (new_user_password.Equals(confirm_new_user_password)) { dr["Password"] = new_user_password; user_login_table_adapter.Update(dr); MessageBox.Show(Properties.Resources.PasswordChanged, "", MessageBoxButton.OK, MessageBoxImage.Information); // TODO: delete/improve this.Close(); } else { MessageBox.Show(Properties.Resources.NewPasswordConfirmationNotMatch, "", MessageBoxButton.OK, MessageBoxImage.Error); // TODO: delete/improve } } } } if (!loginsuccessfull) { MessageBox.Show(Properties.Resources.PasswordUserNotMatch, "", MessageBoxButton.OK, MessageBoxImage.Error); // TODO: delete/improve this.Close(); } else { this.Close(); PageParent.Close(); AppLogin window1 = new AppLogin(); window1.Show(); } } }
private void ButtonLogin_Click(object sender, RoutedEventArgs e) { //Get all needed information from Form string user_login = this.UserLoginValue.Text; string user_password = this.UserPasswordValue.Password; //TODO: Create DB and process it - return and pass to mainWindow - role, and username SqliteLoginDataSet login_dataset = new SqliteLoginDataSet(); UserLoginTableAdapter user_login_table_adapter = new UserLoginTableAdapter(); user_login_table_adapter.Fill(login_dataset.UserLogin); foreach (DataRow dr in login_dataset.UserLogin.Rows) { if (dr["UserName"].ToString() == user_login) { if (dr["Password"].ToString() == user_password) { loginsuccessfull = true; //sanitize locale string locale = sanitize_locale(this); var prodigy_configtool_window = new FileManager(locale, Convert.ToInt32(dr["Role"]), null); prodigy_configtool_window.Show(); this.Close(); } } } if (!loginsuccessfull) { MessageBox.Show(Properties.Resources.PasswordUserNotMatch, "", MessageBoxButton.OK, MessageBoxImage.Error); // TODO: delete/improve //this.Close(); } }
public AppLogin() { string [] args = Environment.GetCommandLineArgs(); //Read from configuration Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(Properties.Settings.Default.DefaultCulture); Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.DefaultCulture); QueriesTableAdapter("attachdbfilename=|DataDirectory|\\Database\\Login\\SqliteLogin.prgy;data source=Database\\Login\\SqliteLogin.prgy"); this.Language = XmlLanguage.GetLanguage( Properties.Settings.Default.DefaultCulture); switch (Properties.Settings.Default.DefaultCulture) { case "pt-PT": InitializeComponent(); RadioLocaleEN_Active.Visibility = Visibility.Collapsed; RadioLocalePT_Active.Visibility = Visibility.Visible; break; case "en-US": InitializeComponent(); RadioLocaleEN_Active.Visibility = Visibility.Visible; RadioLocalePT_Active.Visibility = Visibility.Collapsed; break; default: InitializeComponent(); RadioLocaleEN_Active.Visibility = Visibility.Visible; RadioLocalePT_Active.Visibility = Visibility.Collapsed; break; } if (args.Length == 2) { //Get all needed information from Form string user_login = this.UserLoginValue.Text; string user_password = args[1]; //TODO: Create DB and process it - return and pass to mainWindow - role, and username SqliteLoginDataSet login_dataset = new SqliteLoginDataSet(); UserLoginTableAdapter user_login_table_adapter = new UserLoginTableAdapter(); user_login_table_adapter.Fill(login_dataset.UserLogin); foreach (DataRow dr in login_dataset.UserLogin.Rows) { if (dr["UserName"].ToString() == user_login) { if (dr["Password"].ToString() == user_password) { loginsuccessfull = true; //sanitize locale string locale = sanitize_locale(this); var prodigy_configtool_window = new FileManager(locale, Convert.ToInt32(dr["Role"]), null); prodigy_configtool_window.Show(); this.Close(); } } } if (!loginsuccessfull) { MessageBox.Show(Properties.Resources.PasswordUserNotMatch, "", MessageBoxButton.OK, MessageBoxImage.Error); // TODO: delete/improve this.Close(); } } }