Programatically Check For Admin Settings

Topics: Administration, Core, General
Dec 2, 2011 at 10:10 AM
Edited Dec 2, 2011 at 10:11 AM


There is an option Users can create new accounts on the site Under the Admin-> Settings -> Users

Is there any way to check if this option and other options under Admin->Settings->Users are checked or not using Razor/Programatically


Dec 2, 2011 at 4:00 PM

Yes, you'll see in Orchard.Users/Views/LogOn.cshtml:

    var userCanRegister = @WorkContext.CurrentSite.As<Orchard.Users.Models.RegistrationSettingsPart>().UsersCanRegister;
    var enableLostPassword = @WorkContext.CurrentSite.As<Orchard.Users.Models.RegistrationSettingsPart>().EnableLostPassword;