mirror of
https://github.com/bitwarden/server.git
synced 2025-02-16 01:51:21 +01:00
Change setup validation to use a dto (#1852)
This commit is contained in:
parent
1b0d18a7c5
commit
6f2f475aa3
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Data.SqlClient;
|
||||
using System.Globalization;
|
||||
using System.Net.Http;
|
||||
using System.Text.Json;
|
||||
using System.Net.Http.Json;
|
||||
using Bit.Migrator;
|
||||
|
||||
namespace Bit.Setup
|
||||
@ -272,10 +272,8 @@ namespace Bit.Setup
|
||||
return false;
|
||||
}
|
||||
|
||||
var resultString = response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
|
||||
using var jsonDocument = JsonSerializer.Deserialize<JsonDocument>(resultString);
|
||||
var root = jsonDocument.RootElement;
|
||||
if (!root.GetProperty("Enabled").GetBoolean())
|
||||
var result = response.Content.ReadFromJsonAsync<InstallationValidationResponseModel>().GetAwaiter().GetResult();
|
||||
if (!result.Enabled)
|
||||
{
|
||||
Console.WriteLine("Installation id has been disabled.");
|
||||
return false;
|
||||
@ -326,5 +324,10 @@ namespace Bit.Setup
|
||||
_context.Parameters.Add(_context.Args[i].Substring(1), _context.Args[i + 1]);
|
||||
}
|
||||
}
|
||||
|
||||
class InstallationValidationResponseModel
|
||||
{
|
||||
public bool Enabled { get; init; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user