protected void btnGem_Click(object sender, EventArgs e) { Userfac objuse = new Userfac(); if (txtLogin.Text != "" && txtPassword.Text != "" && txtEmail.Text != "") { if (objuse.UserExists(txtEmail.Text)) { litContent.Text = "<h4>Invaild email!</h4>"; } else { // Her skal oprettelse af ny bruger indsættes Guid _ran = Guid.NewGuid(); kryptering objKryptering = new kryptering(); string salt = objKryptering.GetRandomSalt(); string hashedPassword = objKryptering.HashPassword(txtPassword.Text, salt); var r = _ran.ToString(); Userfac objUsers = new Userfac(); objUsers.SaveUser(txtLogin.Text, hashedPassword, salt, txtEmail.Text, DateTime.Now, r); litContent.Text = "<h4>Brugeren er oprettet!</h4>"; Response.AddHeader("REFRESH", "2;URL=" + Request.RawUrl); } } else { litContent.Text = "<h4>Indtast brugernavn og password!</h4>"; } }
protected void btnSend_Click(object sender, EventArgs e) { Guid _ran = Guid.NewGuid(); kryptering objKryptering = new kryptering(); string salt = objKryptering.GetRandomSalt(); string hashedPassword = objKryptering.HashPassword(txtPassword.Text, salt); var r = _ran.ToString(); dt = objUsers.GetUserByString(Request.QueryString["id"]); objUsers.UpdateUser(hashedPassword, salt, Convert.ToInt32(dt.Rows[0]["fldID"]), r); txtPassword.Text = ""; Response.Redirect("/"); //litOutput.Text = "Dit Password er blevet Resettet"; //Response.AddHeader("REFRESH", "2;URL=/"); }