mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-20 02:28:31 +01:00
Add check for empty theme URI before saving theme settings
This commit is contained in:
parent
06db29dd43
commit
5faa756f1c
@ -979,13 +979,21 @@ namespace BTCPayServer.Controllers
|
||||
var data = await _SettingsRepository.GetSettingAsync<ThemeSettings>() ?? new ThemeSettings();
|
||||
return View(data);
|
||||
}
|
||||
|
||||
|
||||
[Route("server/theme")]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> Theme(ThemeSettings settings)
|
||||
{
|
||||
await _SettingsRepository.UpdateSetting(settings);
|
||||
TempData[WellKnownTempData.SuccessMessage] = "Theme settings updated successfully";
|
||||
if (settings.CustomTheme && !Uri.IsWellFormedUriString(settings.CssUri, UriKind.RelativeOrAbsolute))
|
||||
{
|
||||
TempData[WellKnownTempData.ErrorMessage] = "Please provide a non-empty theme URI";
|
||||
}
|
||||
else
|
||||
{
|
||||
await _SettingsRepository.UpdateSetting(settings);
|
||||
TempData[WellKnownTempData.SuccessMessage] = "Theme settings updated successfully";
|
||||
}
|
||||
|
||||
return View(settings);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user