Ejemplo n.º 1
0
        //*******************************************************
        //
        // The UpdateUser_Click server event handler is used to add
        // the update the user settings
        //
        //*******************************************************

        private void UpdateUser_Click(Object sender, EventArgs e)
        {
            // update the user record in the database
            UsersDB users = new UsersDB();

            users.UpdateUser(userId, Email.Text, PortalSecurity.Encrypt(Password.Text));

            // redirect to this page with the corrected querystring args
            Response.Redirect("~/Admin/ManageUsers.aspx?userId=" + userId + "&username="******"&tabindex=" + tabIndex + "&tabid=" + tabId);
        }
Ejemplo n.º 2
0
        private void LoginBtn_Click(Object sender, ImageClickEventArgs e)
        {
            // Attempt to Validate User Credentials using UsersDB
            UsersDB accountSystem = new UsersDB();
            String  userId        = accountSystem.Login(email.Text, PortalSecurity.Encrypt(password.Text));

            if ((userId != null) && (userId != ""))
            {
                // Use security system to set the UserID within a client-side Cookie
                FormsAuthentication.SetAuthCookie(email.Text, RememberCheckbox.Checked);

                // Redirect browser back to originating page
                Response.Redirect(Request.ApplicationPath);
            }
            else
            {
                Message.Text = "<" + "br" + ">Login Failed!" + "<" + "br" + ">";
            }
        }
Ejemplo n.º 3
0
        private void RegisterBtn_Click(object sender, System.EventArgs e)
        {
            // Only attempt a login if all form fields on the page are valid
            if (Page.IsValid == true)
            {
                // Add New User to Portal User Database
                ASPNET.StarterKit.Portal.UsersDB accountSystem = new ASPNET.StarterKit.Portal.UsersDB();

                if ((accountSystem.AddUser(Name.Text, Email.Text, PortalSecurity.Encrypt(Password.Text))) > -1)
                {
                    // Set the user's authentication name to the userId
                    FormsAuthentication.SetAuthCookie(Email.Text, false);

                    // Redirect browser back to home page
                    Response.Redirect("~/DesktopDefault.aspx");
                }
                else
                {
                    Message.Text = "Registration Failed!  <" + "u" + ">" + Email.Text + "<" + "/u" + "> is already registered." + "<" + "br" + ">" + "Please register using a different email address.";
                }
            }
        }