Hides the user invite button if there is no email server configured
This commit is contained in:
@@ -37,12 +37,15 @@
|
||||
"selected": true
|
||||
};
|
||||
|
||||
vm.defaultButton = {
|
||||
labelKey:"users_inviteUser",
|
||||
handler: function() {
|
||||
vm.setUsersViewState('inviteUser');
|
||||
//don't set this if no email is configured
|
||||
if (Umbraco.Sys.ServerVariables.umbracoSettings.emailServerConfigured) {
|
||||
vm.defaultButton = {
|
||||
labelKey: "users_inviteUser",
|
||||
handler: function () {
|
||||
vm.setUsersViewState('inviteUser');
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
vm.subButtons = [
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Configuration;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
@@ -400,6 +401,7 @@ namespace Umbraco.Web.Editors
|
||||
{"cssPath", IOHelper.ResolveUrl(SystemDirectories.Css).TrimEnd('/')},
|
||||
{"allowPasswordReset", UmbracoConfig.For.UmbracoSettings().Security.AllowPasswordReset},
|
||||
{"loginBackgroundImage", UmbracoConfig.For.UmbracoSettings().Content.LoginBackgroundImage},
|
||||
{"emailServerConfigured", HasSmtpServerConfigured()},
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -447,6 +449,18 @@ namespace Umbraco.Web.Editors
|
||||
return JavaScript(result);
|
||||
}
|
||||
|
||||
private bool HasSmtpServerConfigured()
|
||||
{
|
||||
var config = WebConfigurationManager.OpenWebConfiguration(HttpContext.Request.ApplicationPath);
|
||||
var settings = (MailSettingsSectionGroup)config.GetSectionGroup("system.net/mailSettings");
|
||||
if (settings == null || settings.Smtp == null) return false;
|
||||
if (settings.Smtp.SpecifiedPickupDirectory != null && string.IsNullOrEmpty(settings.Smtp.SpecifiedPickupDirectory.PickupDirectoryLocation) == false)
|
||||
return true;
|
||||
if (settings.Smtp.Network != null && string.IsNullOrEmpty(settings.Smtp.Network.Host) == false)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult ExternalLogin(string provider, string redirectUrl = null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user