/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="role">Either "learner", "observer", "program admin", etc.</param> /// <param name="userName"></param> /// <param name="password"></param> public dynamic LoginAsUser(string role, string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); ClickToAdvance(LoginBtn); // Will need to refactor this once I get a better understanding of roles and how they should be redirected once logged in if (role == "learner") { DashboardPage page = new DashboardPage(Browser); page.WaitForInitialize(); return(page); } if (role == "observer") { DashboardPage page = new DashboardPage(Browser); page.WaitForInitialize(); return(page); } else { DashboardPage page = new DashboardPage(Browser); page.WaitForInitialize(); return(page); } }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the home page to load /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public dynamic Login(IWebDriver browser, string userName, string password) { browser.Navigate().GoToUrl(string.Format("{0}login", System.Configuration.ConfigurationManager.AppSettings["LSURL"].ToString())); LoginPage LSLP = new LoginPage(browser); LSLP.WaitForInitialize(); UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); ClickAndWait(LoginBtn); // If there is only 1 site in an environment, then the application will go to that sites landing page. If there are multiple sites, // then it goes to the Search page. So we first need to wait for an element that appears on BOTH pages (The Sites breadcrumb link) Browser.WaitForElement(Bys.SitePage.SitesBreadCrumbLnk, ElementCriteria.IsVisible); // Then use a TRY to wait a split second for the Sites page Additional Information tab (This tab appears immediately along // with the Sites breadcrumb link). If that doesnt appear, then that means we will be on the Search page, so // we will use the Catch to wait for the Search page try { Browser.WaitForElement(Bys.SitePage.AdditionalInfoTab, TimeSpan.FromMilliseconds(500), ElementCriteria.IsVisible); SitePage page = new SitePage(Browser); return(page); } catch { SearchPage page = new SearchPage(Browser); page.WaitForInitialize(); return(page); } }
void ReleaseDesignerOutlets() { if (ErrLbl != null) { ErrLbl.Dispose(); ErrLbl = null; } if (loginBtn != null) { loginBtn.Dispose(); loginBtn = null; } if (NameBox != null) { NameBox.Dispose(); NameBox = null; } if (PasswordTxt != null) { PasswordTxt.Dispose(); PasswordTxt = null; } if (signUpBtn != null) { signUpBtn.Dispose(); signUpBtn = null; } }
private void UsernameTxt_KeyPress(object sender, KeyPressEventArgs e) { if ((int)e.KeyChar == (int)Keys.Enter) { PasswordTxt.Focus(); } }
/// <summary> /// 帳號欄位按下Enter,焦點換到密碼去 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AccountTxt_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { PasswordTxt.Focus(); } }
//Login method for page object public ProfilePage Login(string username, string password) { UserNameTxt.SendKeys(username); PasswordTxt.SendKeys(password); LoginBtn.Click(); return(new ProfilePage()); }
private void PasswordTxt_Entering(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(PasswordTxt.Text) || PasswordTextEmpty == true) { PasswordTxt.Clear(); // When the text box is clicked on the sample text inside will disappear } PasswordTxt.PasswordChar = '*'; //This line make the User's input in the password textbox appear as *'s }
/// <summary> /// Enters text in the username and password field, clicks the login button, and waits for the home page to load /// </summary> /// <param name="userName"></param> /// <param name="password"></param> public dynamic Login(IWebDriver browser, string userName, string password) { UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); return(ClickAndWait(LoginBtn)); }
public void LoginToWebApp(string user, string pass) { Selenium.WaitUntilElementIsClickable(SignInLnk); SignInLnk.Click(); EmailTxt.Clear(); EmailTxt.SendKeys(user); PasswordTxt.Clear(); PasswordTxt.SendKeys(pass); LoginBtn.Click(); }
private void login() { if (EmailTxt.ToString() == "*****@*****.**" && PasswordTxt.ToString() == "123456") { Application.Current.MainPage.DisplayAlert("Correcto", "Bienvenido", "ok"); } else { Application.Current.MainPage.DisplayAlert("Incorrecto", "Usario y/o contraseña no valido", "ok"); } }
private void ConfirmBtn_Click(object sender, EventArgs e) { if (UsernameTxt.Text == string.Empty || PasswordTxt.Text == string.Empty) { MessageBox.Show("fields must not be empty!"); return; } using (var eb = new POSEntities()) { var u = eb.Logins.FirstOrDefault(x => x.Username == UsernameTxt.Text); if (u != null) { MessageBox.Show("Username already taken."); return; } } if (!SamePassword) { ActiveControl = PasswordTxt; MessageBox.Show("Password does not match"); PasswordTxt.Clear(); ConfirmPassTxt.Clear(); return; } using (var a = new POSEntities()) { var login = new Login(); login.Username = UsernameTxt.Text; login.Password = PasswordTxt.Text; if (!string.IsNullOrWhiteSpace(nameTxt.Text)) { login.Name = nameTxt.Text.Trim(); } login.CanStockIn = false; // login.CanAddSupplier = false; login.CanEditSupplier = false; // login.CanDeleteSupplier = false; //login.CanAddItem = false; login.CanEditItem = false; //login.CanDeleteItem = false; // login.CanAddProduct = false; login.CanEditProduct = false; a.Logins.Add(login); a.SaveChanges(); } MessageBox.Show("Successfully added"); this.Close(); }
private void Login() { if (EmailTxt.ToString() == "*****@*****.**" && PasswordTxt.ToString() == "1234") { Application.Current.MainPage.DisplayAlert("Correcto", "Logrado", "ok"); } else { Application.Current.MainPage.DisplayAlert("Incorrecto", "No fue logrado", "ok"); } }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Library page to load /// </summary> /// <param name="userName"></param> /// <param name="Password"></param> public dynamic LoginAsUser(string userName, string Password) { // Login with a valid user credentials UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(Password); PasswordTxt.SendKeys(Keys.Tab); ClickToAdvance(LoginBtn); Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled); return(new EducationCenterPage(Browser)); }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="userName">The cme360 username</param> /// <param name="password"></param> public MyDashboardPage Login(string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); MyDashboardPage page = ClickAndWait(LoginBtn); return(page); }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="role">Either "learner", "observer", "program admin", etc.</param> /// <param name="userName"></param> /// <param name="password"></param> public HomePage LoginAsExistingUser(string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); HomePage HP = ClickAndWait(LoginBtn); return(HP); }
private async void Register() { if (string.IsNullOrEmpty(this.EmailTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an email", "Accept"); return; } if (string.IsNullOrEmpty(this.PasswordTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter a Password", "Accept"); return; } if (string.IsNullOrEmpty(this.UsernameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Username", "Accept"); return; } if (AgeTxt.ToString() == null) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Age", "Accept"); return; } if (string.IsNullOrEmpty(this.LNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an Last Name", "Accept"); return; } if (string.IsNullOrEmpty(this.FNameTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You must enter an First Name", "Accept"); return; } var user = new User { Email = EmailTxt.ToLower(), Password = PasswordTxt.ToLower(), FirstName = FNameTxt.ToLower(), LastName = LNameTxt.ToLower(), Age = AgeTxt.ToString(), Creation_Date = DateTime.UtcNow.Date }; await App.Database.SaveUserAsync(user);//Anade al nuevo usuario creado en el registro }
private void Achivied(string pw) { PasswordTxt.Invoke(new System.Action(() => { PasswordTxt.Text = pw; })); try { DateTime NowDtTm = DateTime.UtcNow; TimeNeededTxt.Invoke(new System.Action(() => { TimeNeededTxt.Text = (NowDtTm - StartDtTm).ToString(@"d\g\g\:hh\h\h\:mm\m\m\:ss\s\s"); })); TimeNeededTxt.Invoke(new System.Action(() => { StartTxt.Text = (StartDtTm).ToString(); })); TimeNeededTxt.Invoke(new System.Action(() => { EndTxt.Text = (NowDtTm).ToString(); })); this.BackColor = Color.LightGreen; } finally { } }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="role">Either "learner", "observer", "program admin", etc.</param> /// <param name="userName"></param> /// <param name="password"></param> public dynamic LoginAsExistingUser(string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); HomePage HP = ClickToAdvance(LoginBtn); return(HP); //DashboardPage DP = new DashboardPage(Browser); // DP.WaitForInitialize(); // return DP; }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="userName">This is a Description</param> /// <param name="password"></param> public dynamic LoginAsUser(string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); ClickToAdvance(LoginBtn); DashboardPage page = new DashboardPage(Browser); page.WaitForInitialize(); return(page); }
private void ConfirmBtn_Click(object sender, EventArgs e) { if (UsernameTxt.Text == string.Empty || PasswordTxt.Text == string.Empty) { MessageBox.Show("fields must not be empty!"); return; } using (var eb = new EB_LoginsEntities()) { var u = eb.Users.FirstOrDefault(x => x.Username == UsernameTxt.Text); if (u != null) { MessageBox.Show("Username already taken."); return; } } if (!SamePassword) { ActiveControl = PasswordTxt; MessageBox.Show("Password does not match"); PasswordTxt.Clear(); ConfirmPassTxt.Clear(); return; } using (var a = new EB_LoginsEntities()) { var user = new User(); user.Id = Guid.NewGuid().ToString(); user.Username = UsernameTxt.Text; user.Password = PasswordTxt.Text; user.AddLogin = CanAddUser.Checked; user.Rec_Delete = CanDelete.Checked; user.Rec_Edit = CanEdit.Checked; user.Rec_Create = CanReg.Checked; user.Comp_Create = Comp_Reg_cb.Checked; user.Comp_Edit = Comp_Edit_cb.Checked; user.IssueDocument = Issue_Doc_cb.Checked; a.Users.Add(user); a.SaveChanges(); } MessageBox.Show("Successfully added"); this.Close(); }
public async void RegisterMethod() { var user = new User { UserName = UserNameTxt.ToLower(), Password = PasswordTxt.ToLower(), Email = EmailTxt.ToLower(), PhoneNumber = PhoneNumberTxt.ToLower() }; await App.Database.SaveUserAsync(user); await Application.Current.MainPage.DisplayAlert("Datos guardados", "Bienvenido" + userName.ToString(), "Acectar"); await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); #endregion }
/// <summary> /// Enters text in the username and password field, clicks the login button, then waits for the URL /// of the Dashboard page to load /// </summary> /// <param name="role">Either "learner", "observer", "program admin", etc.</param> /// <param name="userName"></param> /// <param name="password"></param> public dynamic LoginAsExistingUser(string userName, string password) { // Login with a valid user UserNameTxt.Clear(); PasswordTxt.Clear(); UserNameTxt.SendKeys(userName); PasswordTxt.SendKeys(password); PasswordTxt.SendKeys(Keys.Tab); ClickToAdvance(LoginBtn); // CBDProgDirectorPage PD = new CBDProgDirectorPage(Browser); // PD.WaitForInitialize(); // return PD; return(null); }
private void Loginbtn_Click(object sender, EventArgs e) { if (UsernameTxt.Text == "" || PasswordTxt.Text == "") { MessageBox.Show("Please Fill in All Fields", "Empty Fields Detected", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { FormOperations.user = DataAccess.GetUsers(UsernameTxt.Text, PasswordTxt.Text); if (FormOperations.user != null) { FormOperations.OpenMenu(); this.Close(); } else { MessageBox.Show("Incorrect Username or Password. Please Try Again"); UsernameTxt.Clear(); PasswordTxt.Clear(); } } }
void ReleaseDesignerOutlets() { if (EmailAddresstxt != null) { EmailAddresstxt.Dispose(); EmailAddresstxt = null; } if (fullnametxt != null) { fullnametxt.Dispose(); fullnametxt = null; } if (PasswordTxt != null) { PasswordTxt.Dispose(); PasswordTxt = null; } if (SaveUserBtn != null) { SaveUserBtn.Dispose(); SaveUserBtn = null; } }
private async void RegisterMethod() { if (string.IsNullOrEmpty(this.email)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter an email.", "Accept"); return; } if (string.IsNullOrEmpty(this.password)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter a password.", "Accept"); return; } string WebAPIkey = "AIzaSyBJ7GurFSPSpXxhwoJ93KU68Ia6rXIMZb4"; try { var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); var auth = await authProvider.CreateUserWithEmailAndPasswordAsync(EmailTxt.ToString(), PasswordTxt.ToString()); string gettoken = auth.FirebaseToken; await Application.Current.MainPage.DisplayAlert("Successfully", "Welcome " + name.ToString() + " to your app", "Ok"); this.IsRunningTxt = false; this.IsVisibleTxt = false; this.IsEnabledTxt = true; await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); } catch (Exception ex) { } }
public async void LoginMethod() { if (string.IsNullOrEmpty(this.email)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter an email.", "Accept"); return; } if (string.IsNullOrEmpty(this.password)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter a password.", "Accept"); return; } string WebAPIkey = "AIzaSyDvh8bOMOG0-bRlSI2cmbbpjHW21Bmzgwg"; var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); try { var auth = await authProvider.SignInWithEmailAndPasswordAsync(EmailTxt.ToString(), PasswordTxt.ToString()); var content = await auth.GetFreshAuthAsync(); var serializedcontnet = JsonConvert.SerializeObject(content); Preferences.Set("MyFirebaseRefreshToken", serializedcontnet); await Shell.Current.GoToAsync($"//ProfilePage"); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Alert", "Invalid useremail or password", "OK"); } this.IsVisibleTxt = true; this.IsRunningTxt = true; this.IsEnabledTxt = false; await Task.Delay(20); this.IsRunningTxt = false; this.IsVisibleTxt = false; this.IsEnabledTxt = true; }
public async void ActualizarMethod() { if (string.IsNullOrWhiteSpace(this.EmailTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Email.", "Accept"); return; } //Valida que el formato del correo sea valido bool isEmail = Regex.IsMatch(EmailTxt, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase); if (!isEmail) { await Application.Current.MainPage.DisplayAlert("Advertencia", "El formato del correo electrónico es incorrecto, revíselo e intente de nuevo.", "OK"); return; } if (string.IsNullOrEmpty(this.PasswordTxt)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Acceptar"); return; } if (string.IsNullOrEmpty(this.RepetircontrasenaTXT)) { await Application.Current.MainPage.DisplayAlert("Error", "You mus enter Password.", "Acceptar"); return; } var user = new User { Email = EmailTxt.ToLower(), Password = PasswordTxt.ToLower(), }; //if (user.Id != 0) //{ //} //else { // await Application.Current.MainPage.DisplayAlert("Usuario no encontrado", "ok", "Aceptar"); // await Application.Current.MainPage.Navigation.PushAsync(new CambiarContraseña()); // return; //} await App.Database.SaveUserAsync(user); await Application.Current.MainPage.DisplayAlert("Datos Actualizados", "Bien echo", "Acectar"); await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); }
private async void OnRegisterClicked() { if (string.IsNullOrEmpty(this.email)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter an email.", "Accept"); return; } if (string.IsNullOrEmpty(this.password)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter a password.", "Accept"); return; } string WebAPIkey = "AIzaSyDvh8bOMOG0-bRlSI2cmbbpjHW21Bmzgwg"; try { var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); var auth = await authProvider.CreateUserWithEmailAndPasswordAsync(EmailTxt.ToString(), PasswordTxt.ToString()); string gettoken = auth.FirebaseToken; await Shell.Current.GoToAsync($"//{nameof(LoginPage)}"); } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Alert", ex.Message, "OK"); } /* * if (string.IsNullOrEmpty(this.name)) * { * await Application.Current.MainPage.DisplayAlert( * "Error", * "You must enter a name.", * "Accept"); * return; * } * if (string.IsNullOrEmpty(this.age)) * { * await Application.Current.MainPage.DisplayAlert( * "Error", * "You must enter an age.", * "Accept"); * return; * } * this.IsVisibleTxt = true; * this.IsRunningTxt = true; * this.IsEnabledTxt = false; * var user = new UserModel * { * EmailField = email, * PasswordField = password, * NamesField = name, * AgeField = age, * Creation_Date = DateTime.Now, * }; * await App.Database.SaveUserModelAsync(user); * await Application.Current.MainPage.DisplayAlert("Successfully", "Welcome " + name.ToString() + " to your app", "Ok"); * this.IsRunningTxt = false; * this.IsVisibleTxt = false; * this.IsEnabledTxt = true; * await Application.Current.MainPage.Navigation.PushAsync(new LoginPage()); */ }
public void EnterPassword(string password) { PasswordTxt.SendKeys(password); }
public async void LoginMethod() { if (string.IsNullOrEmpty(this.email)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter an email.", "Accept"); return; } if (string.IsNullOrEmpty(this.password)) { await Application.Current.MainPage.DisplayAlert( "Error", "You must enter a password.", "Accept"); return; } string WebAPIkey = "AIzaSyBJ7GurFSPSpXxhwoJ93KU68Ia6rXIMZb4"; var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); try { var auth = await authProvider.SignInWithEmailAndPasswordAsync(EmailTxt.ToString(), PasswordTxt.ToString()); var content = await auth.GetFreshAuthAsync(); var serializedcontnet = JsonConvert.SerializeObject(content); Preferences.Set("MyFirebaseRefreshToken", serializedcontnet); //Puede navegar al tener autorizacion await Application.Current.MainPage.Navigation.PushAsync(new ContainerTabbedPags()); this.IsRunningTxt = false; this.IsVisibleTxt = false; this.IsEnabledTxt = true; } catch (Exception ex) { await App.Current.MainPage.DisplayAlert("Alert", "Invalid useremail or password", "OK"); this.IsRunningTxt = false; this.IsVisibleTxt = false; this.IsEnabledTxt = true; } }