Example #1
0
 private void btnGiris_Click(object sender, EventArgs e)
 {
     if (_kullaniciService.GetKullanici(tbxKullaniciAdi.Text, tbxParola.Text) != null && _kullaniciService.GetKullanici(tbxKullaniciAdi.Text, tbxParola.Text).isGecerli)
     {
         IslemlerSayfasi islemForm = new IslemlerSayfasi(_kullaniciService.GetKullanici(tbxKullaniciAdi.Text, tbxParola.Text), this);
         islemForm.Show();
         this.Hide();
     }
     else
     {
         MessageBox.Show("Yanlış Giriş Veya Deaktif Kullanıcı");
     }
 }
Example #2
0
        public IActionResult Login(KullaniciModel kullanici)
        {
            if (ModelState.IsValid)
            {
                var kullaniciModel = _kullaniciService.GetKullanici(kullanici.KullaniciAdi, kullanici.Sifre);
                if (kullaniciModel != null)
                {
                    var claims = new List <Claim>()
                    {
                        new Claim(ClaimTypes.Name, kullaniciModel.KullaniciAdi),
                        new Claim(ClaimTypes.Role, kullaniciModel.Rol.Adi)
                    };
                    var identity  = new ClaimsIdentity(claims, CookieAuthenticationDefaults.AuthenticationScheme);
                    var principal = new ClaimsPrincipal(identity);
                    HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, principal);
                    return(RedirectToAction("Index", "Home"));
                }
                TempData["Message"] = "Geçersiz kullanıcı adı ve şifre.";
            }
            _controllerUtil.SetLiActive("Login");
            ViewBag.LiActives = _controllerUtil.LiActives;
            var model = new KullaniciLoginViewModel
            {
                Kullanici = kullanici
            };

            return(View(model));
        }
Example #3
0
 public KullaniciModel Login(KullaniciModel kullanici)
 {
     try
     {
         var result = _kullaniciService.GetKullanici(kullanici.KullaniciAdi, kullanici.Sifre);
         return(result);
     }
     catch (Exception exc)
     {
         return(null);
     }
 }