Ejemplo n.º 1
0
    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>";
        }
    }
Ejemplo n.º 2
0
    protected void btnSend_Click(object sender, EventArgs e)
    {
        Userfac   objPass     = new Userfac();
        Mailfac   objSendMail = new Mailfac();
        DataTable dt          = new DataTable();

        if (objPass.UserExists(txtEmail.Text))
        {
            litError.Text = "";

            dt = objPass.GetUserByID(txtEmail.Text);

            var p = dt.Rows[0]["fldString"].ToString() + "&date=" + Convert.ToDateTime(dt.Rows[0]["fldDato"]).ToShortDateString();

            var b = "<img src='http://multimedia.pol.dk/archive/00866/Macaca_nigra_self-p_866791y.jpg' /><br /><h1>Reset dit password her!</h1>";
            var m = "<footer style='width:100%; height:100px; background-color:grey; position:absolute; bottom:0px;'><div style='text-align:center;'><a href='http://localhost:24244/Reset?id=" + p + "'>Reset Password</a></div></footer>";

            dt = objSendMail.GetEmailSys();

            objSendMail.SendMyMail(txtEmail.Text, dt.Rows[0]["fldEmail"].ToString(), b, m.ToString(), dt.Rows[0]["fldPassword"].ToString());
        }
        else
        {
            litError.Text = "<p style='color:red;'>Email eksistere ikke!</p>";
        }
    }
Ejemplo n.º 3
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        if (txtUser.Text != "" && txtPassword.Text != "")
        {
            Userfac objLogin = new Userfac();

            if (objLogin.UserLogin(txtUser.Text, txtPassword.Text))
            {
                // Opret evt. session osv. her

                Session["login"] = objLogin.UserLogin(txtUser.Text, txtPassword.Text);

                Response.Redirect("/Admin");
            }
            else
            {
                litError.Text = "<h4>Login mislykkedes!</h4>";
            }
        }
        else
        {
            litError.Text = "<h4>Login mislykkedes!</h4>";
        }
    }