feat: enable registration toggle and update Navbar to reflect registration status

This commit is contained in:
2026-01-04 11:16:09 -05:00
parent f5de211611
commit 159fcc2a89
4 changed files with 21 additions and 6 deletions
@@ -23,6 +23,8 @@ namespace SharpbinV3.Server.Controllers
[Route("register")]
public async Task<IActionResult> Register([FromBody] RegisterRequest request)
{
if (!options.Value.Registration_Enabled)
return BadRequest(new { message = "Registration is disabled." });
if (!await _verification.VerifyAsync(request.Token, Utilities.GetRequestIP(HttpContext)))
return BadRequest(new { message = "Verification failed." });
@@ -106,7 +108,8 @@ namespace SharpbinV3.Server.Controllers
var authSettings = options.Value;
return Ok(new
{
cf_turnstile_site_key = string.IsNullOrEmpty(authSettings.CF_Turnstile_SiteKey) ? null : authSettings.CF_Turnstile_SiteKey
cf_turnstile_site_key = string.IsNullOrEmpty(authSettings.CF_Turnstile_SiteKey) ? null : authSettings.CF_Turnstile_SiteKey,
registration_enabled = authSettings.Registration_Enabled
});
}
@@ -4,5 +4,6 @@
{
public string CF_Turnstile_SiteKey { get; set; } = string.Empty;
public string CF_Turnstile_SecretKey { get; set; } = string.Empty;
public bool Registration_Enabled { get; set; } = true;
}
}