protected void ImgSubmitForgot_Click(object sender, ImageClickEventArgs e) { divForgot.Attributes.Add("Style", "display:none"); DivlnkForgot.Attributes.Add("Style", "display:block"); divlblForgotmessage.Attributes.Add("Style", "display:block"); Global ObjPassword = new Global(); DataSet ds = new DataSet(); ds = ObjPassword.GetPasswordAdmin(txtforgotUsername.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { lblForgotmessage.Text = "<br> Please check your mail account <br> for username and password"; string Message = " <table cellpadding='5' cellspacing='0' width='50%' border='1' style='background:#F1EBE2;'>" + "<tr><td colspan='2'><h1 style='font-size:20px; color:#503414;'>Forgot Password</h1></td>" + "</tr><tr><td style='width:20%;'>Username :</td>" + "<td> " + txtforgotUsername.Text.Trim() + "</td>" + "</tr><tr><td>Password :</td>" + "<td> " + ds.Tables[0].Rows[0]["Password"].ToString() + "</td></tr></table>"; SendMails ObjMai = new SendMails(); ObjMai.SendEmails(ConfigurationManager.AppSettings["FromEmail"], txtforgotUsername.Text.Trim(), "Fritzy's : Password detail", Message); } else { lblForgotmessage.Text = "<br> Please enter valid username.<br> "; } DivlnkForgot.Attributes.Add("Style", "display:none"); ModalLogin.CancelControlID = "closeLoginWindow"; ModalLogin.Show(); txtforgotUsername.Text = ""; }
public void InvalidPassword() { ModalLogin pageModalLogin = new ModalLogin(); Actions.CheckPassword(); Assert.AreEqual(Settings.ErrorMessages.invalidPassword, pageModalLogin.lblErrorPassword.Text); }
/* * Forgot password click will validate user mailid from database and send mail to this mailid which include Username and password * else show the message invalid user * */ protected void ImgSubmitForgot1_Click(object sender, ImageClickEventArgs e) { divForgot.Attributes.Add("Style", "display:none"); DivlnkForgot.Attributes.Add("Style", "display:block"); divlblForgotmessage.Attributes.Add("Style", "display:block"); Global ObjPassword = new Global(); DataSet ds = new DataSet(); ds = ObjPassword.GetPasswordAdmin(txtforgotUsername.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { lblForgotmessage.Text = "<br> Please check your mail account <br> for username and password"; string Message = ContentManager.GetStaticeContentEmail("ForgotPassword.htm").Replace("~", "#"); Message = Message.Replace("<!-- Username -->", txtforgotUsername.Text.Trim()); Message = Message.Replace("<!-- Password -->", ds.Tables[0].Rows[0]["Password"].ToString()); SendMails ObjMai = new SendMails(); ObjMai.SendEmails(ConfigurationManager.AppSettings["FromEmail"], txtforgotUsername.Text.Trim(), "Password Help from Fritzy's Pet Care Pros.", Message); } else { lblForgotmessage.Text = "<br> Please enter valid username.<br> "; } DivlnkForgot.Attributes.Add("Style", "display:none"); ModalLogin.CancelControlID = "closeLoginWindow"; ModalLogin.Show(); txtforgotUsername.Text = ""; }
public void InvalidEmail() { ModalLogin pageModalLogin = new ModalLogin(); Actions.CheckEmail(); Assert.AreEqual(Settings.ErrorMessages.invalidEmail, pageModalLogin.lblErrorEmail.Text); }
public static void LoginWithExcel() { NavigateTo.Login(); List <UserData> users = new List <UserData>(); users = ReadData(); ModalLogin pageModalLogin = new ModalLogin(); Index pageIndex = new Index(); foreach (UserData user in users) { Thread.Sleep(3000); pageModalLogin.txtEmail.SendKeys(user.Email); pageModalLogin.txtPassword.SendKeys(user.Password); pageModalLogin.btnBeginSesion.Click(); Thread.Sleep(3000); Actions.UpdateDriver(); if (pageIndex.CheckSesion()) { pageIndex.btnAccount.Click(); Thread.Sleep(2000); pageIndex.opcSignOut.Click(); NavigateTo.Login(); } else { pageModalLogin.SaveResult(); WriteResult(user, pageModalLogin.result); pageModalLogin.txtEmail.Clear(); pageModalLogin.txtPassword.Clear(); } } }
public static void CheckEmail() { NavigateTo.Login(); ModalLogin pageModalLogin = new ModalLogin(); pageModalLogin.txtEmail.SendKeys(Settings.InvalidCredentials.invalidEmail); pageModalLogin.txtPassword.SendKeys(Settings.InvalidCredentials.invalidPassword); pageModalLogin.btnBeginSesion.Click(); }
public static void RequireFieldsLogin() { NavigateTo.Login(); ModalLogin pageModalLogin = new ModalLogin(); pageModalLogin.txtEmail.SendKeys(Settings.InvalidCredentials.withoutEmail); pageModalLogin.txtPassword.SendKeys(Settings.InvalidCredentials.withoutEmail); pageModalLogin.btnBeginSesion.Click(); }
protected void btnLogin_Click(object sender, ImageClickEventArgs e) { StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "false") { Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); lblLoginerror.Visible = false; if (chkRemember.Checked == true) { HttpContext.Current.Request.Cookies.Clear(); if (Request.Cookies["remUsername"] == null) { HttpCookie c = new HttpCookie("remUsername", txtUsername.Text); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); } if (Request.Cookies["remPassword"] == null) { HttpCookie c = new HttpCookie("remPassword", txtPassword.Text); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); } } else { Response.Cookies["remUsername"].Expires = DateTime.Now.AddYears(-30); Response.Cookies["remPassword"].Expires = DateTime.Now.AddYears(-30); } Response.Redirect("index.aspx"); } else { lblLoginerror.Visible = true; lblLoginerror.Text = "Your Account Is Disabled By Administrator of This Site/n Please Contact Administrator."; } } else { lblLoginerror.Visible = true; ModalLogin.Show(); } }
public void LoginFields() { ModalLogin pageModalLogin = new ModalLogin(); Actions.RequireFieldsLogin(); Assert.Multiple(() => { Assert.AreEqual(Settings.ErrorMessages.emptyField, pageModalLogin.lblErrorPassword.Text); Assert.AreEqual(Settings.ErrorMessages.emptyField, pageModalLogin.lblErrorEmail.Text); }); }
/* * On clickin this button will check the user validation and Authenticatio of user then set UserType, cookie, * On error it will show message */ protected void btnLogin_Click(object sender, ImageClickEventArgs e) { StoreFront objStoreFront = new StoreFront(); DataSet ds = new DataSet(); ds = objStoreFront.GetLoginUser(txtUsername.Text.Trim(), txtPassword.Text.Trim()); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["IsActive"].ToString().ToLower() == "false") { Session["UserName"] = ds.Tables[0].Rows[0]["UserName"].ToString(); Session["MemberName"] = ds.Tables[0].Rows[0]["FullName"].ToString(); Session["UserID"] = ds.Tables[0].Rows[0]["UserID"].ToString(); Session["IsLogin"] = "******"; Session["UserType"] = ds.Tables[0].Rows[0]["UserType"].ToString(); if (chkRemember.Checked == true) { Request.Cookies.Remove("remUsername"); Request.Cookies.Remove("remPassword"); HttpContext.Current.Request.Cookies.Clear(); var cookieTextUserName = Encoding.UTF8.GetBytes(txtUsername.Text); var cookieTextUserPassword = Encoding.UTF8.GetBytes(txtPassword.Text); var encryptedUserNameValue = Convert.ToBase64String(MachineKey.Protect(cookieTextUserName, "myAdminKey")); var encryptedPasswordValue = Convert.ToBase64String(MachineKey.Protect(cookieTextUserPassword, "myAdminKey")); HttpCookie c = new HttpCookie("remUsername", encryptedUserNameValue); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); HttpCookie c1 = new HttpCookie("remPassword", encryptedPasswordValue); c1.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c1); if (Request.Cookies["IsLogin"] == null) { HttpCookie c2 = new HttpCookie("IsLogin", "1"); c2.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c2); } Response.Redirect(string.Concat(Convert.ToString(Session["HomePath"]), "Appointmentnew.aspx")); } else { Response.Cookies["remUsername"].Expires = DateTime.Now.AddYears(-30); Response.Cookies["remPassword"].Expires = DateTime.Now.AddYears(-30); HttpCookie c = new HttpCookie("IsLogin", "0"); c.Expires = DateTime.Now.AddDays(Convert.ToDouble(ConfigurationManager.AppSettings["addCookieForDay"])); Response.Cookies.Add(c); Response.Redirect(string.Concat(Convert.ToString(Session["HomePath"]), "Appointmentnew.aspx")); } } else { lblLoginerror.Visible = true; lblLoginerror.Text = "Your account Has been disabled by administrator of this site ,please contact administrator"; ModalLogin.Show(); } } else { lblLoginerror.Visible = true; ModalLogin.Show(); } }