protected void btnRegistracija_Click(object sender, EventArgs e)
        {
            Kupci k = DAKupci.provjeriEmail(tbEmail.Text);

            if (k == null)
            {
                Kupci kup = new Kupci();
                kup.Ime               = tbIme.Text;
                kup.Prezime           = tbPrezime.Text;
                kup.DatumRegistracije = DateTime.Now;
                kup.Email             = tbEmail.Text;
                string salt = UIHelper.GenerateSalt();
                kup.LozinkaSalt = salt;
                kup.LozinkaHash = UIHelper.GenerateHash(tbPassword.Text, salt);
                kup.Status      = true;

                DAKupci.Insert(kup);

                Response.Redirect("/KorisniciSistema/Prijava.aspx");

                ClearForm();
            }
            else
            {
                string display = "Email je zauzet!";
                ClientScript.RegisterStartupScript(this.GetType(), "Upozorenje", "alert('" + display + "');", true);
            }
        }
Exemple #2
0
        protected void btnSacuvaj_Click(object sender, EventArgs e)
        {
            Kupci k = DAKupci.provjeriEmail(tbEmail.Text);

            if (k == null)
            {
                Kupci kup = new Kupci();
                kup.KupacID = Convert.ToInt32(User.Identity.Name);
                kup.Email   = tbEmail.Text;
                string salt = UIHelper.GenerateSalt();
                kup.LozinkaSalt = salt;
                kup.LozinkaHash = UIHelper.GenerateHash(tbPassword.Text, salt);
                DAKupci.update(kup);

                BindForm();
            }
        }