public BasicAuthenticationHandler( IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, IKorisnik userService) : base(options, logger, encoder, clock) { _userService = userService; }
public bool UserLoginCheck(string usernName, string password) { IKorisnik repo = RepoFactory.GetKorisnikRepo(); bool result = false; foreach (var item in repo.GetAllUsers()) { if (item.KorisnickoIme == usernName && item.Zaporka == password) { result = true; break; } } return(result); }
public ActionResult Login(UserLoginModel ulm) { IHelperMethods helper = RepoFactory.GetHelperMethods(); IKorisnik repo = RepoFactory.GetKorisnikRepo(); if (helper.UserLoginCheck(ulm.UserName, ulm.Password)) { Session["userName"] = ulm.UserName; Session["userID"] = repo.GetUserId(ulm.UserName, ulm.Password); return(RedirectToAction("Index", "Home")); } else { return(View(ulm)); } }
public bool ContainsUserName(string userName) { IKorisnik repo = RepoFactory.GetKorisnikRepo(); var result = false; List <KorisnikModel> korisnikModels = repo.GetAllUsers(); foreach (var item in korisnikModels) { if (item.KorisnickoIme == userName) { result = true; break; } } return(result); }
public ActionResult Register(KorisnikModel k) { IKorisnik repo = RepoFactory.GetKorisnikRepo(); try { if (ModelState.IsValid) { repo.InsertUser(k); return(RedirectToAction("Login", "Account")); } else { return(View(k)); } } catch (Exception) { return(RedirectToAction("CustomeError", "Error", new { message = "Greška: Korisnik nije dodan." })); } }
public KorisnikController(IKorisnik korisnik) { _korisnik = korisnik; }