private bool AuthenticateUser(string p_UserName, string p_Password, RequestContext p_RequestContext) { try { var l_PassHash = ""; using (var l_SelectQuery = new DatabaseQuery(Database.Connection, true)) { l_SelectQuery.AppendLine("SELECT PassHash"); l_SelectQuery.AppendLine(" FROM Periscopix.dbo.prscpxUsers"); l_SelectQuery.AppendLine(" WHERE Company = 1 AND UserName = @Username"); l_SelectQuery.AddWithValue("@Username", p_UserName); using (var l_Reader = new ExDataReader(l_SelectQuery.ExecuteReader())) { if (l_Reader.Read()) { l_PassHash = l_Reader.GetString(); } } } var l_Success = BCrypt.CheckPassword(p_Password, l_PassHash); if (l_Success) { CreateSuccessReply(ref p_RequestContext, l_PassHash); } return true; } catch { return false; } }