Esempio n. 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request["submit"] != null)
        {
            string firstName = Request["firstName"];
            string lastName  = Request["lastName"];
            string password  = Request["userPassword"];
            string email     = Request["email"];
            string id        = Request["id"];

            if (DataLink.IsEmailRegistered(email))
            {
                serverResponse = string.Format("'{0}' is already registered", email);
            }
            else if (DataLink.IsIDRegistered(id))
            {
                serverResponse = string.Format("'{0}' is already registered", id);
            }
            else
            {
                DataLink.AddUser(email, firstName, lastName, password, id);
                serverResponse = "User created";
                AccessControl.LogIn(this, email, false);
                Response.Redirect("Homepage.aspx");
            }
        }
    }
Esempio n. 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string email    = Request["loginEmail"];
        string password = Request["loginPassword"];

        if (email != null && password != null && Request["submit"] != null)
        {
            email = email.Replace("'", "");
            if (DataLink.Exists(email, password))
            {
                AccessControl.LogIn(this, email, DataLink.IsAdmin(email));
                loginResponse = "You have logged in successfully.";
                Response.Redirect("Homepage.aspx");
            }
            else
            {
                loginResponse = "Email and password don't match";
            }
        }
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!AccessControl.IsLoggedIn(this))
        {
            Response.Redirect("Homepage.aspx");
            return;
        }
        DataTable user = DataLink.GetUser(AccessControl.GetLoggedUser(this));

        formInputs = ContructInputs(
            GetFirstFromTable(user, "FirstName"),
            GetFirstFromTable(user, "LastName"),
            GetFirstFromTable(user, "ID"),
            GetFirstFromTable(user, "Email"));

        if (Request["submit"] != null)
        {
            string firstName = Request["firstName"];
            string lastName  = Request["lastName"];
            string password  = Request["userPassword"];
            string email     = Request["email"];
            string id        = Request["id"];

            if (email != GetFirstFromTable(user, "Email") && DataLink.IsEmailRegistered(email))
            {
                serverResponse = string.Format("'{0}' is already registered", email);
            }
            else if (id != GetFirstFromTable(user, "ID") && DataLink.IsIDRegistered(id))
            {
                serverResponse = string.Format("'{0}' is already registered", id);
            }
            else
            {
                DataLink.UpdateUser(GetFirstFromTable(user, "Email"), email, firstName, lastName, password, id);
                AccessControl.LogIn(this, email, DataLink.IsAdmin(email));
                WriteScript("alert('Data Updated')");
                // If we would have used Response.Redirect, it wouldn't have loaded the alert
                WriteScript("window.location = 'Homepage.aspx'");
            }
        }
    }