Пример #1
0
        public async Task <IActionResult> Login([FromForm] LoginDtIn data)
        {
            try
            {
                using (MySqlConnection con = new MySqlConnection(_settings.Database.ConnectionString))
                {
                    con.Open();
                    var cmdStr = $"select * from users where username = '******' and password = '******'";
                    using (MySqlCommand command = new MySqlCommand(cmdStr, con))
                    {
                        command.ExecuteNonQuery();
                        var reader = command.ExecuteReader();
                        if (reader.HasRows)
                        {
                            return(await _authService.ForceAuthenticationAsync());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                _logger.Error("Something terrible happened here!", ex);
            }

            return(BadRequest());
        }
Пример #2
0
 public async Task <IActionResult> LoginNew([FromForm] LoginDtIn data)
 {
     return(await _authService.AuthenticationResponseAsync());
 }