fixed one of URL prefix and Host should be required

This commit is contained in:
andy zheng
2016-02-28 13:30:11 -05:00
parent ad6a2b96e5
commit 026acc4aa9

View File

@@ -68,6 +68,10 @@ namespace Orchard.MultiTenancy.Controllers {
ModelState.AddModelError("Name", T("Invalid tenant name. Must contain characters only and no spaces.").Text);
}
if (!string.Equals(viewModel.Name, "default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace( viewModel.RequestUrlHost) && string.IsNullOrWhiteSpace(viewModel.RequestUrlPrefix)) {
ModelState.AddModelError("RequestUrlHostRequestUrlPrefix", T("RequestUrlHost and RequestUrlPrefix can not be empty at the same time.").Text);
}
if (!ModelState.IsValid) {
return View(viewModel);
}
@@ -139,6 +143,10 @@ namespace Orchard.MultiTenancy.Controllers {
if (tenant == null)
return HttpNotFound();
if (!string.Equals(viewModel.Name, "default", StringComparison.OrdinalIgnoreCase) && string.IsNullOrWhiteSpace(viewModel.RequestUrlHost) && string.IsNullOrWhiteSpace(viewModel.RequestUrlPrefix)) {
ModelState.AddModelError("RequestUrlHostRequestUrlPrefix", T("RequestUrlHost and RequestUrlPrefix can not be empty at the same time.").Text);
}
if (!ModelState.IsValid) {
return View(viewModel);
}