Example #1
0
 protected void Page_Init(object sender, EventArgs e)
 {
     if (Session["loggedInUser"] == null)
     {
         Response.Redirect("/Default.aspx?redirect=" + Request.Url);
     }
     else
     {
         oLoggedInUser = (LoginAccount)Session["loggedInUser"];
     }
 }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         if (Request["logout"] != null)
         {
             Session.Abandon();
             Response.Redirect("Default.aspx");
         }
         else if (Session["loggedInUser"] != null)
         {
             LoginAccount oAccount = (LoginAccount)Session["loggedInUser"];
             PerformRedirect(oAccount);
         }
     }
 }
Example #3
0
 void PerformRedirect(LoginAccount oAccount)
 {
     if (!Request["redirect"].IsNull())
     {
         sRedirect = Request["redirect"].ToString();
     }
     if (oAccount.IsActive)
     {
         Session["loggedInUser"] = oAccount;
         Response.Redirect(sRedirect ?? "Dashboard.aspx");
     }
     else
     {
         DivError.Visible   = true;
         DivError.InnerHtml = "Account Disabled";
     }
 }
Example #4
0
        public string UpdatePassword(string sExisting, string sNew, string sRepeat)
        {
            try
            {
                string sID = ((LoginAccount)Session["loggedInUser"]).AccountID;

                LoginAccount oProfile = oDB.LoginAccounts.Where(x => x.AccountID == sID).FirstOrDefault();

                if (oProfile.Password == sExisting)
                {
                    if (sNew == sRepeat)
                    {
                        if (oDF.ValidatePassword(sNew))
                        {
                            oProfile.Password = sNew;
                        }
                        else
                        {
                            return("Password Must Have Minimum 8 and Maximum 14 characters at least 1 Uppercase Alphabet, 1 Lowercase Alphabet, 1 Number and 1 Special Character");
                        }
                    }
                    else
                    {
                        return("Repeat Password Mismatch");
                    }
                }
                else
                {
                    return("Existing Password Mismatch");
                }
                oDB.SaveChanges();

                return("1");
            }
            catch
            {
                return("Error Processing Request");
            }
        }//
Example #5
0
        protected void BtnSubmitClick(object sender, EventArgs e)
        {
            try
            {
                string sEmailID  = tbUserName.Text.Trim();
                string sPassword = tbPassword.Text.Trim();

                LoginAccount oAccount = oDB.LoginAccounts.Where(d => d.Email == sEmailID && d.Password == sPassword && d.IsActive).FirstOrDefault();
                if (oAccount != null)
                {
                    PerformRedirect(oAccount);
                }
                else
                {
                    DivError.Visible   = true;
                    DivError.InnerHtml = "Invalid Email Or Password";
                }
            }
            catch (Exception ex)
            {
                DivError.Visible   = true;
                DivError.InnerHtml = ex.Message;
            }
        }