Hi DynamicWeb,
We have a DW9 solution with two websites in the same DynamicWeb installation. Both websites use extranet login, but the users need to be separated per website/shop.
Previously, this has worked for us by posting a custom ShopId as part of the login form. This allowed us to control which shop context should be used when authenticating the user.
In the current LogOn method in LogOnHandler, the shop ID is resolved inside the authentication block:
string shopId = PageView.Current()?.Area?.EcomShopId;
This value is then used when calling:
User.Authenticate(username, password, PermissionLevels.Frontend, shopId, true);
However, the OnBeforeExtranetLogin notification is triggered before shopId is resolved:
NotificationManager.Notify(
Notifications.Standard.User.OnBeforeExtranetLogin,
new Notifications.Standard.User.OnBeforeExtranetLoginArgs()
{
UserName = username,
Password = password
});
Would it be possible to move the resolving of shopId higher up in the LogOn method and include it in the OnBeforeExtranetLoginArgs notification?
For example, something along these lines:
string shopId = PageView.Current()?.Area?.EcomShopId;
NotificationManager.Notify(
Notifications.Standard.User.OnBeforeExtranetLogin,
new Notifications.Standard.User.OnBeforeExtranetLoginArgs()
{
UserName = username,
Password = password,
ShopId = shopId
});
The important part for us is that the notification subscriber would be able to override the shopId before the user is authenticated.
This would make it possible to support cases where the shop context should be controlled by the login form, for example when posting a ShopId from the frontend login form in a multi-site DW9 solution.
Use case:
- One DW9 solution
- Two websites/sites in the same installation
- Extranet users must be separated between the two sites
- Login form posts
ShopId - Authentication should use the posted
ShopIdinstead of only relying onPageView.Current()?.Area?.EcomShopId
Is this something that could be added to DW9, so shopId can be adjusted in OnBeforeExtranetLogin before User.Authenticate(...) is called?
Best regards,
Anders