This week we would like to show you two new Orchard Core demos: the user account activation and the new CORS module. But before that let's take a quick look at the newest features and improvements of Orchard Core! Finally, let's see what about the next Harvest?
Orchard Core updates
Add more Resources documentation
The Resources page of the Orchard Core documentation has been improved a lot. Now on this page, you can find examples about how to register a named resource by implementing the
IResourceManifestProvider interface, how to render your registered resources in the different sections of the page using Liquid or Razor and many more!
Update the OpenID YesSql stores to execute a concurrency check on updates
We have a new feature in YesSql when saving a session. Check out the following line:
_session.Save(application, checkConcurrency: true);
In the code snippet above, we would like to save the Open ID application and check that nothing has changed the application between it was loaded in this process and saved with the current changes. And if there is an issue, it will throw an exception when we call
await _session.CommitAsync(). Then it will catch the
ConcurrencyException saying something else changed the application while you were saving it so, please try it again.
Fix issue with layers that can be drag and dropped to zones
The targets for the zone dragging were too loose and then you could drag a widget to a layer or a layer to a widget. Now it's fixed.
Fix regression for Tag Helpers not working
There was an issue that some things were working in development mode and not in release mode. In development, Orchard Core finds the Tag Helpers because views are compiled at run time in the context of the application, while published .Views.dll files have been precompiled in the context of their related module or theme. In production, it will not work, because for example if you would like to use the
ContentItemTagHelper, the reference was missing from one module to the
OrchardCore.Contents module. Dean Marcussen created a new
OrchardCore.Contents.TagHelpers project, that contains the Tag Helpers of the
OrchardCore.Contents module. And now whenever we have Tag Helpers, we put them in their
*.TagHelpers library. So, when our themes and other modules will need those Tag Helper, we can just reference this library and not the full module. In the
_ViewImports.cshtml files where we are using the
OrchardCore.Contents assembly to find Tag Helpers we need to look for the assembly named
OrchardCore.Contents.TagHelpers. It should not break any websites if you are using Liquid, but if you are not using Liquid, it's possible that the site will be broke after this change, meaning the Tag Helpers won't be found and as we said, you need to change your
_ViewImports.cshtml. In the future, we have to do the same for all of the Tag Helpers.
Standard display option for each field
If you want to add a Display option for a field that does not have a standard one, when you re-edit the settings and save, the new one will be selected as the default even if you don't want it. To solve this issue we added a Standard option for all the fields. Let's see the
HtmlField.DisplayOption.cshtml file as an example.
Sort Workflow instances
Your Workflow could have several Workflow instances and if you have many of them, it could be hard to find the one you want. In the past, you had the option to filter the instances by their status (all, faulted, finished), and now there is a new option to sort these instances. You can sort them by the recently created or the least recently created.
Simplify part settings retrieval for ContentPartDisplayDrivers
ContentPartDisplayDrivers, we need to resolve the
ContentDefinitionManager, query the type definition and then find the part that is named the same that we are using, take the first one and get the settings. But in the
UpdatePartEditorContext we already have the
TypePartDefinition of the part that we are currently editing, so we can just get the settings from there. This change made the code simpler and technically faster. Just take a look at the changes in the
User Account Activation
Currently, Orchard Core supports registration and approval or manual entry. What about having a way to have the option to invite users onto the platform and let them choose their password and then activate their account? Let's see a possible future release for this feature!
Install your site and then enable the Users Registration feature. Now head to Security -> Settings -> Registration, where you will find a new option: Administrators can send an activation email to a user. Put a tick in this box and select the AllowRegistration from the select list.
Now go to Security -> Users and hit the Add User button. Here you could see a new switch called Send Activation Email?. If you create this user with this switch enabled and hit Save, this user will get an email that email will contain an activation link. If the user clicks on this link, they can choose a password for the account. After they set the password their account is activated and they can log in to the site using the newly created password. To do that, you should disable the account of the user when creating it.
But what's behind this feature? Create two new Workflows to send emails. Let's call the first one to UserAccountActivation and add the Account Activation event as the startup event for this Workflow. Then add a Send Email task that will send the email to the user. This email will contain the activation URL of the user.
Create another Workflow that will send another email that tells the user that their account is activated. Let's call this Workflow UserAccountActivated. Here you could use the Account Activated event as the startup event and again, add a Send Email task.
The feature will be improved in the future because as you can see, the Send Activation Email switch is not really about sending an email, it's just about rising an event, that you can use in your Workflows. Instead of this, we could have for example a user state (Needs Activation) similar to the IsDisabled switch.
And that's not all! If you would like to know more about this feature, head to YouTube, where you can find the full demo about the user account activation!
Cross-Origin Resource Sharing (CORS) module
If you head to Configuration -> Features and enable the Cors Configuration module, you will find a new option under Configuration -> Settings, called Cors. If you navigate here you can add as many policies as you want using the Add a policy button. On this page, you can add the name of the policy, set that as the default policy and configure everything that you will need to enable CORS.
If you are interested in the full demo, don't forget to check out the recording on YouTube!
News from the community
The possible date of the next Harvest
We had two possible dates for the next Harvest: one in February and one in April. Now it looks like it won't happen in February, so the only option left is to do a Harvest in April. The possible days could be between 13 and 17 in April. We also have two possible locations, which are Nice and Miami. Stay tuned for more information about the next Harvest!
Tell us about your .NET performance challenges! - Hastlayer developer survey
Help us build the nerdiest .NET thing, Hastlayer: It turns performance-critical sections of .NET programs into computer chips! If you fill out our short questionnaire you can win a cool compute accelerator board worth $265! Check it out here:
The reason we're asking this is that we're building a .NET hardware accelerator, Hastlayer (https://github.com/Lombiq/Hastlayer-SDK it turns your program into a chip!) and want to better understand what other developers do. Thank you in advance!
Orchard Dojo Newsletter
Now we have 114 subscribers of the Lombiq's Orchard Dojo Newsletter! We have started this newsletter to inform the community around Orchard with the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post published to Orchard Dojo, including This week in Orchard of course.
Do you know of other Orchard enthusiasts who you think would like to read our weekly articles? Tell them to subscribe here!