mirror of
https://github.com/aliasvault/aliasvault.git
synced 2026-05-07 06:46:01 -04:00
Rename public registration enabled flag (#343)
This commit is contained in:
@@ -372,11 +372,11 @@ set_support_email() {
|
||||
}
|
||||
|
||||
set_public_registration() {
|
||||
printf "${CYAN}> Checking PUBLIC_REGISTRATION...${NC}\n"
|
||||
if ! grep -q "^PUBLIC_REGISTRATION=" "$ENV_FILE" || [ -z "$(grep "^PUBLIC_REGISTRATION=" "$ENV_FILE" | cut -d '=' -f2)" ]; then
|
||||
update_env_var "PUBLIC_REGISTRATION" "true"
|
||||
printf "${CYAN}> Checking PUBLIC_REGISTRATION_ENABLED...${NC}\n"
|
||||
if ! grep -q "^PUBLIC_REGISTRATION_ENABLED=" "$ENV_FILE" || [ -z "$(grep "^PUBLIC_REGISTRATION_ENABLED=" "$ENV_FILE" | cut -d '=' -f2)" ]; then
|
||||
update_env_var "PUBLIC_REGISTRATION_ENABLED" "true"
|
||||
else
|
||||
printf " ${GREEN}> PUBLIC_REGISTRATION already exists.${NC}\n"
|
||||
printf " ${GREEN}> PUBLIC_REGISTRATION_ENABLED already exists.${NC}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -15,5 +15,5 @@ public class Config
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether public registration is enabled.
|
||||
/// </summary>
|
||||
public bool PublicRegistration { get; set; }
|
||||
public bool PublicRegistrationEnabled { get; set; }
|
||||
}
|
||||
|
||||
@@ -333,7 +333,7 @@ public class AuthController(IDbContextFactory<AliasServerDbContext> dbContextFac
|
||||
public async Task<IActionResult> Register([FromBody] RegisterRequest model)
|
||||
{
|
||||
// Check if public registration is disabled in the configuration.
|
||||
if (!config.PublicRegistration)
|
||||
if (!config.PublicRegistrationEnabled)
|
||||
{
|
||||
return BadRequest(ServerValidationErrorResponse.Create(["New account registration is currently disabled on this server. Please contact the administrator."], 400));
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ builder.Configuration.AddJsonFile("appsettings.json", optional: false, reloadOnC
|
||||
builder.Configuration.AddJsonFile($"appsettings.{builder.Environment.EnvironmentName}.json", optional: true, reloadOnChange: true);
|
||||
|
||||
var config = new Config();
|
||||
var publicRegistration = Environment.GetEnvironmentVariable("PUBLIC_REGISTRATION") ?? "false";
|
||||
config.PublicRegistration = bool.Parse(publicRegistration);
|
||||
var publicRegistrationEnabled = Environment.GetEnvironmentVariable("PUBLIC_REGISTRATION_ENABLED") ?? "false";
|
||||
config.PublicRegistrationEnabled = bool.Parse(publicRegistrationEnabled);
|
||||
|
||||
builder.Services.AddSingleton(config);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"JWT_KEY": "12345678901234567890123456789012",
|
||||
"DATA_PROTECTION_CERT_PASS": "Development",
|
||||
"PUBLIC_REGISTRATION": "true"
|
||||
"PUBLIC_REGISTRATION_ENABLED": "true"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://0.0.0.0:5092"
|
||||
@@ -21,7 +21,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development",
|
||||
"JWT_KEY": "12345678901234567890123456789012",
|
||||
"DATA_PROTECTION_CERT_PASS": "Development",
|
||||
"PUBLIC_REGISTRATION": "true"
|
||||
"PUBLIC_REGISTRATION_ENABLED": "true"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "https://0.0.0.0:7223"
|
||||
|
||||
Reference in New Issue
Block a user