Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var gen=new AlphaNumericPasswordGenerator();

            var pgen = new PronounceablePasswordGenerator();
            //var pwds=pgen.Generate(10000, 8);

            //for (var j=0;j<pwds.Count;j++)
            //{
            //    try
            //    {
            //        ht.Add(pwds[j], 1);
            //    }
            //    catch (System.Exception ex)
            //    {
            //        MessageBox.Show(j.ToString());
            //        break;
            //    }
            //}

            long i = 0;
            while (true)
            {
                //var g = Guid.NewGuid().ToString().Replace("-", "");
                //var guid = g.Substring(g.Length - 6, 6);
                try
                {
                    //ht.Add(guid, 1);
                    //ht.Add(GetUniqueKey(), 1);

                    ht.Add(Guid.NewGuid(),1);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show(i.ToString());
                    break;
                }

                i++;
                if (i == 100000000)
                {
                    break;
                }
            }
        }
Beispiel #2
0
    protected void ButtonAddUser_Click(object sender, EventArgs e)
    {
        string userName = TextBoxEmailAddress.Text.Trim();
        string email = TextBoxEmailAddress.Text.Trim();
        Sloppycode.PronounceablePasswordGenerator generator = new Sloppycode.PronounceablePasswordGenerator();
        ArrayList passwords = generator.Generate(1, 8);
        string defaultPassword = passwords[0].ToString();

        MembershipUserCollection members = Membership.GetAllUsers();
        foreach (MembershipUser u in members)
        {
            if (u.UserName == userName)
            {
                Session["Error"] = "<font color=\"red\">Email already in use</font>";
                return;
            }
        }

        Membership.CreateUser(userName, defaultPassword, userName);

        string role = "User";
        Roles.AddUserToRole(userName, role);
        ProfileBase.Create(userName);
        //this.profile = ProfileBase.Create(userName);
        VolunteerTracker.User user = new VolunteerTracker.User();
        user.Email = email;
        user.Name = userName;
        user.Save();
        //SaveSettings();
        string url = "quickpm.net";

        if (ConfigurationManager.AppSettings["DatabaseName"] != null)
        {
            url = ConfigurationManager.AppSettings["DatabaseName"] + ".quickpm.net";
        }
        string message = "Email: " + email + "\r\nPassword: "******"" + "\r\n" + "To login go to " + url;
        SendEmail.Send(TextBoxEmailAddress.Text.Trim(), "VolunteerTracker Login Information", message, Request.PhysicalApplicationPath);
        Session["ManageUsers-UserAdded"] = userName;
    }