I have an AppPlugin called 2fa. After login I can see the javascript defined in the package.manifest is injected into the page. However, I would like the 2fa-login.js injected at the point of /umbraco/login. Please can someone explain how this can be achieved?
Am working on an umbraco 13 project. The files are injected as desired in an umbraco 11 project.
I've finally implemented a solution for v13, however it changes again slightly in v15. For 13:
// overwrite the GetTwoFactorView method
public class CustomtBackOfficeTwoFactorOptions : IBackOfficeTwoFactorOptions
{
public string GetTwoFactorView(string username) => "/App_Plugins/Custom2FaProvider/login.js";
}
I also needed two other pieces of functionality, one was to prevent users disabling 2fa, and to auto enroll in the provider on account creation.
to achieve the auto enrollment I programatically created the entry in umbracoTwoFactor table by listening to UserSavedNotification and determining if was created today & if was already was enrolled, then used npoco to create the entry
to prevent disable, I extended my ValidateTwoFactorPIN method, took a stacktrace to determine the source and either returned false or allowed the 2fa to continue.
both very less than ideal but work well. Would be great to have a method to overide in the future for these purposes @Umbraco!
Would be happy to assist with your implementation if required too.
How to inject javascript into /umbraco/login
I have an AppPlugin called 2fa. After login I can see the javascript defined in the package.manifest is injected into the page. However, I would like the 2fa-login.js injected at the point of /umbraco/login. Please can someone explain how this can be achieved?
Am working on an umbraco 13 project. The files are injected as desired in an umbraco 11 project.
Would appreciate any thoughts on this matter.
Hi Adam,
Did you identify a solution for this issue?
We're also looking at options for this.
Thank you, Ryan
I've finally implemented a solution for v13, however it changes again slightly in v15. For 13:
use lit to create the markup/functionality in the js an example is here: https://github.com/umbraco/Umbraco-CMS/blob/v13/bugfix/fix-duplicate-reference-to-imagesharp2/src/Umbraco.Web.UI.Login/src/components/pages/mfa.page.element.ts
I also needed two other pieces of functionality, one was to prevent users disabling 2fa, and to auto enroll in the provider on account creation.
to achieve the auto enrollment I programatically created the entry in umbracoTwoFactor table by listening to UserSavedNotification and determining if was created today & if was already was enrolled, then used npoco to create the entry
to prevent disable, I extended my ValidateTwoFactorPIN method, took a stacktrace to determine the source and either returned false or allowed the 2fa to continue.
both very less than ideal but work well. Would be great to have a method to overide in the future for these purposes @Umbraco!
Would be happy to assist with your implementation if required too.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.