public override Entity Execute(ActionContext context) { Entity entity = null; LoginForm form = new LoginForm(); User[] users = context.AssetManager.GetUsers(); form.DialogOK += (s, e) => { entity = users.FirstOrDefault ( u => u.Username.Equals(form.Username) && u.Password.Equals(ComputeHash(form.Password)) ); if (entity != null) { form.Close(); } else { form.SetErrorText(ErrorMessage); } }; form.ShowDialog(context.WindowOwner); return(entity); }
public void Verify(string userName, string password) //TODO: Store if a successful login occured { //username will not be case-sensitive userName = userName.ToLower(); //get the account from the database with the username (UN-COMMENT WHEN DBCONNECTOR IS IMPLEMENTED Account account = DBConnector.getAccount(userName); //if the database did not return an account if (account == null) { loginForm.loginError("Invalid username"); return; } if (Verify(password, account)) //if this password is valid for the account { DBConnector.StoreLogin(account); //store successful login //decide which homepage to open if (account.Role == "Technician") { HomepageTech form = new HomepageTech(account); form.Show(); } else { HomepageAgent form = new HomepageAgent(account); form.Show(); } loginForm.Close(); } else //invalid password { loginForm.loginError("Invalid password"); } }
private bool Login() { LoginForm loginForm = null; bool result = false; try { loginForm = new LoginForm(); if (Session.IsLogin()) { Utilities.ShowMessage(CommonMessage.APPLICATION_IS_RUNNING); result = false; } else { loginForm.ShowDialog(); if (Session.IsLogin()) { result = true; } loginForm.Close(); } return(result); } catch (Exception) { throw; } finally { loginForm = null; } }
public void TestLoginCredentials(string loginName, string loginPassword) { LoginForm loginForm = null; // Ensure construction, opening and closing doesn't fail. Assert.DoesNotThrow( () => { loginForm = new LoginForm("http://www.workshare.com") { LoginName = loginName, LoginPassword = loginPassword }; loginForm.Show(); Application.DoEvents(); loginForm.Close(); Application.DoEvents(); }, "Failed to show login form."); Assert.NotNull(loginForm, "Login form should not be null."); // The returned username should be the same as was set. // Unless the input was null, in which case an empty string is returned. Assert.AreEqual((loginName ?? string.Empty), loginForm.LoginName, "The user name was not as expected."); // The returned password should always be an empty string, // because the password would not have been entered. Assert.AreEqual(string.Empty, loginForm.LoginPassword, "The password was not as expected."); }
private static void ShowLoginForm() { var mainWindow = DiFactory.Resolve <MainWindow>(); mainWindow.Visible = false; mainWindow.Hide(); LoginForm form = DiFactory.Resolve <LoginForm>(); bool logined = false; form.Logined += (sndr, arg) => { logined = true; form.Close(); }; form.ShowDialog(); if (logined) { mainWindow.Init(); Application.Run(mainWindow); } else { Application.Exit(); } }
/// <summary> /// Handler for signing in event. /// </summary> /// <param name="sender"></param> /// <param name="eventArgs"></param> public void SignIn(object sender, LoginForm.SignInEventArgs eventArgs) { var authManager = AuthManager.GetInstance(); string message = authManager.SignIn(eventArgs.Login, eventArgs.Password); if (message == null) //null means ok { _loginForm.Clear(); _loginForm.Visible = false; MainFormController mainFormController = new MainFormController(); mainFormController.Start(); if (mainFormController.ExitRequested) { _loginForm.Close(); } else { _loginForm.Visible = true; } } else { MessageBox.Show(message); } }
public String[] PromptForCredentials() //throws CanceledOperationException { try { LoginForm lForm = new LoginForm(); lForm.ShowDialog(); name = lForm.getUserName(); if (name.Length == 0) { throw new CanceledOperationException("User Name empty"); } password = lForm.getPassword(); lForm.Close(); } catch (IOException e) { throw new CanceledOperationException("Failed to get the name and password.\n" + e.Message); } return(new String[] { name, password, group, role, discriminator }); }
void MQOEvents_onOpenCharacterSelection(object obj) { // here after connection LoginForm.Close(); CharForm = new CharacterSelectionForm((string)obj); CharForm.ShowDialog(); }
public static void Main() { if (CheckRunning()) { return; } CheckForUpdates(); InitDatabase(); SCOUT.Security.Security.Initialize(); DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.OfficeSkins).Assembly); DevExpress.Skins.SkinManager.Default.RegisterAssembly(typeof(DevExpress.UserSkins.BonusSkins).Assembly); LoginForm loginForm = new LoginForm(); s_mainForm = loginForm; if (loginForm.ShowDialog() != DialogResult.OK) { return; } loginForm.Close(); loginForm.Dispose(); CheckResolution(); s_splashForm = new SplashForm(); s_splashForm.StartPosition = FormStartPosition.CenterScreen; s_splashForm.Show(); Application.DoEvents(); SetStatus("SCOUT is starting..."); Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InstalledUICulture; Application.Idle += Application_Idle; Application.ThreadExit += Application_ThreadExit; s_mainForm = new mainForm(); Application.Run(s_mainForm); //} //catch (Exception e) //{ // throw; // //MessageBox.Show(e.Message + Environmen, Application.ProductName, // // MessageBoxButtons.OK, MessageBoxIcon.Error); //} }
protected static void loginButton_Click(object sender, LoginButtonClickEventArgs e) { if (FillSchema(e.Login, e.Password)) { Schemeform = new SchemeForm(ExcelApplication, AddInSchema); LoginForm.Close(); Schemeform.Show(); } else { LoginForm.SetErrorMessage("Не подключения, или неверная пара логин-пароль."); } }
public Zamestnanec CheckLogin() { do { var logForm = new LoginForm(); // FormManager.Current.CreateForm<LoginForm>(); if (logForm.ShowDialog() == System.Windows.Forms.DialogResult.OK) { var param = (LoginParameters)logForm.GetParameters(); LoggedUser = param.User; logForm.Close(); } else { //MessageBox.Show("") logForm.Close(); //logForm.Dispose(); //FormManager.Current.ExitThread(); } } while (LoggedUser == null); return(LoggedUser); }
/// <summary> /// Register an FTP connection from saved or new credentials. /// </summary> /// <param name="savedState">The login informations of the FTP.</param> /// <param name="showForm">Show the registration form, if the saved state did not work.</param> /// <returns></returns> public Task <string> Register(string savedState = null, bool showForm = true) { var result = new TaskCompletionSource <string>(); // Try to use the old credentials try { var oldCreds = JsonConvert.DeserializeObject <LoginCredentials>(Obscure.Base64Decode(savedState)); result.SetResult(savedState); creds = oldCreds; return(result.Task); } catch { // Ignored } // If the saved creds were not usable and showForm is false, return with failure if (!showForm) { result.SetResult(null); return(result.Task); } // If the old ones failed, try to get new ones var form = new LoginForm(); var success = false; form.OnResult += newCreds => { creds = newCreds; success = true; result.SetResult(Obscure.Base64Encode(JsonConvert.SerializeObject(newCreds))); form.Close(); }; form.FormClosed += (sender, e) => { if (!success) { result.SetResult(null); } }; form.Show(); return(result.Task); }
private void loginButton_Click(object sender, EventArgs e) { this.loginForm = new LoginForm(); var dr = loginForm.ShowDialog(); if (dr == DialogResult.Cancel) //si cierra la ventana { loginForm.Close(); } if (dr == DialogResult.OK) //si se loguea { var loginResult = loginForm.lastLoginResult; this.onLogin(loginForm.loggedUser); } }
private void button1_Click(object sender, RibbonControlEventArgs e) { if (loginForm == null) { loginForm = new LoginForm(ConnectionString); } if (!isAuthorized) { if (loginForm.isAuthorized) { Storage.ConnectionString = string.Format( ConnectionString, loginForm.DataSource, loginForm.InitialCatalog, loginForm.login, loginForm.password); isAuthorized = true; if (!loginForm.IsDisposed) { loginForm.Close(); } } else { if (!loginForm.IsDisposed) { loginForm.Show(); } else { loginForm = new LoginForm(ConnectionString); loginForm.Show(); } return; } } if (form != null) { form.Close(); } form = new EntityForm(Globals.ThisAddIn.Application); if (!form.isClose) { form.Show(); } }
public void CheckResult() { model.checkLogin(view.txtEmail.Text, view.txtPassword.Password); bool result = model.getResult(); if (result) { HomeWindow home = new HomeWindow(); home.Show(); view.Close(); } else { MessageBox.Show("Username / Password Invalid!"); view.txtEmail.Focus(); } }
private void button1_Click(object sender, EventArgs e) { if (cmbAction.SelectedItem.ToString().Equals("Í˳ö")) { SyncForm frm = new SyncForm(); frm.ShowDialog(); login.Close(); login.Dispose(); } else { login.Refresh(); login.Show(); this.Dispose(); mainForm.Dispose(); } }
private void MainForm_FormClosed(object sender, FormClosedEventArgs e) { frmLogin.Close(); }
public void GoToMainPage() { _mainForm.Show(); _logForm.Close(); }
static void Main() { Application.SetHighDpiMode(HighDpiMode.SystemAware); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); using (var lf = new LoginForm()) { lf.ConnectionSuccessfull += (sqlcs) => { var m = new MainForm(); m.mainForm.Show(); m.mainForm.FormClosed += (s, e) => lf.Close(); GlobalSettings.User = sqlcs.UserID; }; Application.Run(lf); } }
private void MainWindow_FormClosing(object sender, FormClosingEventArgs e) { _loginForm.Close(); }
public void closeLoginForm(LoginForm loginForm, TimeInOutForm timeInOutForm) { loginForm.Close(); timeInOutForm.Show(); }
public static void LoginOk() { loginForm.Close(); loginForm.Dispose(); mainWindow.LoginOk(); }
private void FrmSplashScreen_Load(object sender, EventArgs e) { LockSplash = 1; try { _loginScreen = new LoginForm(this); _loginScreen.Show(); //_loginScreen.EnableConnect(CGlobalCache.LoadCache(this)); while (!_autoEvent.WaitOne(50, true)) { Application.DoEvents(); } if (_loginScreen.Connect) { _loginScreen.Close(); } else { _loginScreen.Close(); Connect = false; Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message); _loginScreen.Close(); Close(); } progressBar.Minimum = 0; progressBar.Maximum = CGlobalCache.Lock; progressBar.Step = 1; }