Exemplo n.º 1
0
        protected void btnCreateUser_Click(object sender, EventArgs e)
        {
            string password = rndPassword.GeneratePassword();

            try
            {
                MDBUser.CreateUser(txtUsername.Text, password, txtFirstname.Text, txtLastname.Text, (MDBUser.UserType) int.Parse(ddlType.SelectedValue));
                tblUser.Visible = false;
                SetMessage($"{txtUsername.Text} blev oprettet med password {password}");
            }
            catch (MembershipCreateUserException ex)
            {
                if (ex.StatusCode == MembershipCreateStatus.DuplicateUserName)
                {
                    SetMessage("MANR er oprettet i forvejen", true);
                }
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                Response.Redirect("~/");
            }

            //Fjernes ved live!
            if (Membership.GetUser("370929") == null)
            {
                MDBUser.CreateUser("370929", "test1234", "Stiig", "Gade", MDBUser.UserType.Admin);
            }
            if (Membership.GetUser("417317") == null)
            {
                MDBUser.CreateUser("417317", "test1234", "Thomas", "á Rogvi", MDBUser.UserType.Admin);
            }
            ///////////////////////////
        }