protected void Save_Click(object sender, EventArgs e) { eFact.BLL.Login objLogin = new eFact.BLL.Login(); if (VerifyPassword()) { objLogin.SaveUserPassword(ConfigurationManager.AppSettings["GlbUserId"], ConfirmNewPassword.Text); Response.Redirect("efactModules.aspx"); } }
protected void Login_Click(object sender, EventArgs e) { eFact.BLL.Login objLogin = new eFact.BLL.Login(); string loginExists = "0"; loginExists = objLogin.CheckUserExists(tbxUserName.Text, pwbPassword.Text, out objLogin); if (loginExists != "0") { if (objLogin != null) { if (objLogin.RecordStatus == "U") { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('User is in Unauthorized state. Please check this with your Security Officer(s)');", true); } else if (objLogin.ActivationDate > DateTime.Today) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('User activation date is not reached. Activation date is " + objLogin.ActivationDate + "');", true); } else if (DateTime.Today > objLogin.ProfileEndDate) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Your login profile date has expired, please contact your Security Officer(s)');", true); } else if (CheckUserPasswordExpireDate(objLogin)) { ConfigurationManager.AppSettings["GlbUserId"] = tbxUserName.Text; Response.Redirect("ChangePassword.aspx"); Session["OldPassword"] = pwbPassword.Text; } //else if ((objLogin.PasswordExpireDate - DateTime.Today).Days <= Convert.ToInt32(Session["PasswordExpireDate"])) //{ // ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Last sucessful Login date = " + objLogin.LastLoginDate.Date + "');", true); // ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Password is expired, please change your password');", true); // ConfigurationManager.AppSettings["GlbUserId"] = tbxUserName.Text; // Response.Redirect("ChangePassword.aspx"); // Session["OldPassword"] = pwbPassword.Text; //} else { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Last sucessful Login date = " + objLogin.LastLoginDate.Date + "');", true); ConfigurationManager.AppSettings["GlbUserId"] = tbxUserName.Text; //string glbUserId = ConfigurationManager.AppSettings["GlbUserId"].ToString(); Response.Redirect("efactModules.aspx"); } } } else { /* Failure report */ FailureText.Text = "User not Exists !"; } }
public bool CheckUserPasswordExpireDate(eFact.BLL.Login objLogin) { bool IsUserPasswordExpire = true; if (objLogin.PasswordExpireDate > DateTime.Today) { IsUserPasswordExpire = false; if ((objLogin.PasswordExpireDate - DateTime.Today).Days <= Convert.ToInt32(Session["PasswordExpireDate"])) { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Password will expire about " + (objLogin.PasswordExpireDate - DateTime.Today).Days + " day(s)');", true); } } else { ScriptManager.RegisterStartupScript(this, GetType(), "alert", "alert('Password is expired, please change your password');", true); } return(IsUserPasswordExpire); }
protected void Login_Click(object sender, EventArgs e) { eFact.BLL.Login objLogin = new eFact.BLL.Login(); string loginExists = "0"; loginExists = objLogin.CheckUserExists(tbxUserName.Text, pwbPassword.Text); if (loginExists != "0") { ConfigurationManager.AppSettings["GlbUserId"] = loginExists; //string glbUserId = ConfigurationManager.AppSettings["GlbUserId"].ToString(); Response.Redirect("efactModules.aspx"); } else { FailureText.Text = "User not Exists !"; } }