Exemple #1
0
        public ActionResult ObrisiPConfirmed(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            string posiljalac = Session["idGosta"].ToString();

            var prez  = db.PRIJATELJI_REZERVACIJA.Where(x => x.EMAIL_GOSTA1 == posiljalac).Where(x => x.EMAIL_GOSTA == gost.EMAIL_GOSTA).ToList();
            var prez2 = db.PRIJATELJI_REZERVACIJA.Where(y => y.EMAIL_GOSTA1 == gost.EMAIL_GOSTA).Where(x => x.EMAIL_GOSTA == posiljalac).ToList();

            foreach (var item in prez)
            {
                PRIJATELJI_REZERVACIJA pri = db.PRIJATELJI_REZERVACIJA.Where(x => x.ID == item.ID).Where(x => x.EMAIL_GOSTA == item.EMAIL_GOSTA).Single();
                db.PRIJATELJI_REZERVACIJA.Remove(pri);
            }
            foreach (var item in prez2)
            {
                PRIJATELJI_REZERVACIJA pri = db.PRIJATELJI_REZERVACIJA.Where(x => x.ID == item.ID).Where(x => x.EMAIL_GOSTA == item.EMAIL_GOSTA).Single();
                db.PRIJATELJI_REZERVACIJA.Remove(pri);
            }
            PRIJATELJI pr  = db.PRIJATELJIs.Find(posiljalac, gost.EMAIL_GOSTA);
            PRIJATELJI pr2 = db.PRIJATELJIs.Find(gost.EMAIL_GOSTA, posiljalac);

            db.PRIJATELJIs.Remove(pr);
            db.PRIJATELJIs.Remove(pr2);
            db.SaveChanges();
            return(RedirectToAction("Profil"));
        }
Exemple #2
0
        public ActionResult Create(GOST gost)
        {
            try
            {
                // TODO: Add insert logic here
                GOST g = new GOST();
                g.EMAIL_GOSTA   = gost.EMAIL_GOSTA;
                g.PASS_GOSTA    = gost.PASS_GOSTA;
                g.IME_GOSTA     = gost.IME_GOSTA;
                g.PREZIME_GOSTA = gost.PREZIME_GOSTA;
                g.POL_GOSTA     = "m";
                g.MAIL_POTVRA   = false;
                g.CPASS_GOSTA   = gost.CPASS_GOSTA;
                g.SLIKA         = null;

                db.GOSTs.Add(g);
                db.SaveChanges();

                return(RedirectToAction("LogIn"));
            }
            catch
            {
                return(View());
            }
        }
Exemple #3
0
        //public object Utility { get; private set; }

        public ActionResult Profil()
        {
            if (Session["idGosta"] == null)
            {
                RedirectToAction("LogIn", "Registracija");
            }
            else
            {
                string idGosta = Session["idGosta"].ToString();
                GOST   g       = new GOST();
                g = db.GOSTs.Where(z => z.EMAIL_GOSTA == idGosta).Single();
                Restoran.ModelView.Profil prof = new ModelView.Profil();
                prof.adresa  = "Brigadira Ristica c8/5";
                prof.email   = g.EMAIL_GOSTA;
                prof.ime     = g.IME_GOSTA;
                prof.prezime = g.PREZIME_GOSTA;
                var pr = db.PRIJATELJIs.Where(x => x.EMAIL_GOSTA == idGosta).Select(x => x.EMAIL_GOSTA1).ToList();

                prof.prijatelji = new List <GOST>();
                foreach (var item in pr)
                {
                    prof.prijatelji.Add(db.GOSTs.Where(z => z.EMAIL_GOSTA == item).Single());
                }
                return(View(prof));
            }

            return(null);
        }
Exemple #4
0
        public ActionResult OdbijP(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            if (gost == null)
            {
                return(HttpNotFound());
            }

            return(View(gost));
        }
Exemple #5
0
        public ActionResult Dodaj(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            if (gost == null)
            {
                return(HttpNotFound());
            }
            TempData["idGosta"] = Session["idGosta"];
            return(View(gost));
        }
Exemple #6
0
        public ActionResult OdbijPConfirmed(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            string     posiljalac = Session["idGosta"].ToString();
            PRIJATELJI pr         = db.PRIJATELJIs.Find(gost.EMAIL_GOSTA, posiljalac);


            db.PRIJATELJIs.Remove(pr);

            db.SaveChanges();
            return(RedirectToAction("Profil"));
        }
Exemple #7
0
        public ActionResult Dodaj2(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            if (gost == null)
            {
                return(HttpNotFound());
            }
            string posiljalac = Session["idGosta"].ToString();


            return(View(gost));
        }
        public ActionResult ConfirmEmail(string Token)
        {
            GOST gost = db.GOSTs.Find(Token);


            gost.MAIL_POTVRA = true;
            db.GOSTs.Attach(gost);
            var entry = db.Entry(gost);

            entry.Property(e => e.MAIL_POTVRA).IsModified = true;
            db.SaveChanges();

            return(View());
        }
        public ActionResult Register(GOST gost)
        {
            var userWithSameEmail = db.GOSTs.Where(m => m.EMAIL_GOSTA == gost.EMAIL_GOSTA).SingleOrDefault();

            if (ModelState.IsValid)
            {
                if (userWithSameEmail == null)
                {
                    if (gost.PASS_GOSTA != gost.CPASS_GOSTA)
                    {
                        return(View(gost));
                    }
                    else
                    {
                        gost.MAIL_POTVRA = false;
                    }
                    System.Net.Mail.MailMessage m = new System.Net.Mail.MailMessage(
                        new System.Net.Mail.MailAddress("*****@*****.**", "Registracija na web"),
                        new System.Net.Mail.MailAddress(gost.EMAIL_GOSTA));
                    m.Subject    = "Povrda e-mail adrese";
                    m.Body       = string.Format("Postovani {0},<BR/>Hvala vam na registraciji, kliknite na link ispod da potvrdite: <a href=\"{1}\" title=\"User Email Confirm\">{1}</a>", gost.EMAIL_GOSTA, Url.Action("ConfirmEmail", "Account", new { Token = gost.EMAIL_GOSTA }, Request.Url.Scheme));
                    m.IsBodyHtml = true;
                    System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com", 587);
                    smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "al255593");
                    smtp.EnableSsl   = true;

                    ServicePointManager.ServerCertificateValidationCallback =
                        delegate(object s, X509Certificate certificate,
                                 X509Chain chain, SslPolicyErrors sslPolicyErrors)
                    { return(true); };

                    smtp.Send(m);

                    db.GOSTs.Add(gost);
                    db.SaveChanges();


                    return(RedirectToAction("CekajKonfirmaciju"));
                }
                else

                {
                    ViewBag.Message = "Postoji korisnik sa ovom adresom!";
                    return(View(gost));
                }
            }

            return(View(gost));
        }
Exemple #10
0
        public ActionResult Dodaj2Confirmed(string ime, string prezime)
        {
            GOST gost = db.GOSTs.Where(x => x.IME_GOSTA == ime).Where(y => y.PREZIME_GOSTA == prezime).Single();

            string     posiljalac = Session["idGosta"].ToString();
            PRIJATELJI pr         = new PRIJATELJI();

            pr.EMAIL_GOSTA1  = posiljalac;
            pr.EMAIL_GOSTA   = gost.EMAIL_GOSTA;
            pr.PRIJATELJI_OD = System.DateTime.Now;

            db.PRIJATELJIs.Add(pr);

            db.SaveChanges();
            return(RedirectToAction("Profil"));
        }
Exemple #11
0
        public ActionResult Edit(ModelView.Profil prof)
        {
            GOST gost = db.GOSTs.Find(prof.Email);

            if (ModelState.IsValid)
            {
                gost.IME_GOSTA       = prof.ime;
                gost.PREZIME_GOSTA   = prof.prezime;
                gost.EMAIL_GOSTA     = prof.Email;
                gost.PASS_GOSTA      = prof.pass;
                gost.CPASS_GOSTA     = prof.cpass;
                db.Entry(gost).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Profil"));
            }

            return(View(gost));
        }
Exemple #12
0
        public ActionResult Edit(string id)
        {
            string email = Session["idGosta"].ToString();
            GOST   gost  = db.GOSTs.Find(email);

            if (gost == null)
            {
                return(HttpNotFound());
            }
            ModelView.Profil prof = new ModelView.Profil();
            prof.ime     = gost.IME_GOSTA;
            prof.prezime = gost.PREZIME_GOSTA;
            prof.Email   = gost.EMAIL_GOSTA;
            prof.pass    = gost.PASS_GOSTA;
            prof.cpass   = gost.CPASS_GOSTA;

            return(View(prof));
        }
Exemple #13
0
        static void Main(string[] args)
        {
            BigInteger p = new BigInteger("6277101735386680763835789423207666416083908700390324961279", 10);
            BigInteger a = new BigInteger("-3", 10);
            BigInteger b = new BigInteger("64210519e59c80e70fa7e9ab72243049feb8deecc146b9b1", 16);

            byte[]     xG   = FromHexStringToByte("03188da80eb03090f67cbf20eb43a18800f4ff0afd82ff1012");
            BigInteger n    = new BigInteger("ffffffffffffffffffffffff99def836146bc9b1b4d22831", 16);
            DSGost     DS   = new DSGost(p, a, b, n, xG);
            BigInteger d    = DS.GenPrivateKey(192);
            ECPoint    Q    = DS.GenPublicKey(d);
            GOST       hash = new GOST(256);

            byte[] H      = hash.GetHash(Encoding.Default.GetBytes("Message"));
            string sign   = DS.SignGen(H, d);
            bool   result = DS.SignVer(H, sign, Q);

            Console.WriteLine(result);
        }
        public ActionResult Login(GOST gost)
        {
            if (db.GOSTs.Where(x => x.EMAIL_GOSTA == gost.EMAIL_GOSTA).Select(z => z.PASS_GOSTA).SingleOrDefault() == gost.PASS_GOSTA)
            {
                GOST gost2 = db.GOSTs.Find(gost.EMAIL_GOSTA);
                if (gost2.MAIL_POTVRA == true)
                {
                    Session["idGosta"] = gost.EMAIL_GOSTA;

                    return(RedirectToAction("Profil", "Profil"));
                }
                else
                {
                    ViewBag.Message = "Morate potvrditi vašu e-mail adresu da biste se prijavili!";
                    return(View());
                }
            }
            else if (db.ADMINs.Where(x => x.ID_ADMIN == gost.EMAIL_GOSTA).Select(z => z.PASS_ADMINA).SingleOrDefault() == gost.PASS_GOSTA)
            {
                Session["idAdmina"] = gost.EMAIL_GOSTA;


                return(RedirectToAction("ProfilAdmina", "ProfilAdmina"));
            }


            else if (db.MENADZERs.Where(x => x.IDMENADZERA == gost.EMAIL_GOSTA).Select(z => z.ASD).SingleOrDefault() == gost.PASS_GOSTA)
            {
                var men = db.MENADZERs.Where(x => x.IDMENADZERA == gost.EMAIL_GOSTA).Single();

                Session["idMenadzera"] = men.IDMENADZERA;
                Session["idRestorana"] = men.ID_RESTORANA;
                return(RedirectToAction("ProfilMenadzera", "ProfilMenadzera"));
            }

            else
            {
                ModelState.AddModelError("", "Korisnik sa unetim podacima ne postoji.");
                return(View(gost));
            }
        }
Exemple #15
0
        static void Main(string[] args)
        {
            GOST G    = new GOST(256);
            GOST G512 = new GOST(512);

            byte[] message =
            {
                0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37,
                0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31,
                0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35,
                0x34, 0x33, 0x32, 0x31, 0x30, 0x39, 0x38, 0x37, 0x36, 0x35, 0x34, 0x33, 0x32, 0x31, 0x30
            };
            byte[] res  = G.GetHash(message);
            byte[] res2 = G512.GetHash(message);
            string h256 = BitConverter.ToString(res);
            string h512 = BitConverter.ToString(res2);

            Console.WriteLine(h256);
            Console.WriteLine();
            Console.WriteLine(h512);
            Console.ReadLine();
        }
Exemple #16
0
        public ActionResult LogIn(GOST gost)
        {
            try
            {
                if (db.GOSTs.Where(x => x.EMAIL_GOSTA == gost.EMAIL_GOSTA).Select(x => x.PASS_GOSTA).Single() == gost.PASS_GOSTA)
                {
                    Session["idGosta"] = gost.EMAIL_GOSTA;
                    return(RedirectToAction("Profil", "Profil"));
                }
                else
                {
                    return(RedirectToAction("LogIn"));
                }
            }
            catch (Exception)
            {
                try
                {
                    if (db.MENADZERs.Where(x => x.IDMENADZERA == gost.EMAIL_GOSTA).Select(x => x.ASD).Single() == gost.PASS_GOSTA)
                    {
                        Session["idMenadzera"] = gost.EMAIL_GOSTA;
                        return(RedirectToAction("ManagerLogin", "Profil"));
                    }
                    else
                    {
                        return(RedirectToAction("Login"));
                    }
                }
                catch (Exception)
                {
                    return(RedirectToAction("LogIn"));
                }
                return(RedirectToAction("LogIn"));
            }

            return(null);
        }