Esempio n. 1
0
        public IActionResult Login()
        {
            var form     = HttpContext.Request.Form;
            var username = form["login"];
            var password = form["password"];

            if (!_userService.ContainUser(username))
            {
                throw new ArgumentException($"Cant find user {username}"); //сделать обработку искл для отобр на стр
            }
            _userService.CheckPassword(username, password);                //тут тоже

            Ok(new { login = username, token = $"Bearer {_tokenService.GetToken(username)}" });
            return(View("~/Views/Home/Index.cshtml"));
        }
        public IActionResult Check(User user)
        {
            var response = _userService.CheckPassword(user.Login, user.Password);

            return(Ok(response));
        }