From 52338fa0d48b5651756d872146b0b58f1b5d4549 Mon Sep 17 00:00:00 2001 From: Nick Hoang Date: Thu, 8 Nov 2018 15:42:30 +0700 Subject: [PATCH 1/2] #13: typo of removeauthenticator localize key fixed --- Umbraco2FA/views/Dashboard.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Umbraco2FA/views/Dashboard.html b/Umbraco2FA/views/Dashboard.html index d457e1b..be7a5f5 100644 --- a/Umbraco2FA/views/Dashboard.html +++ b/Umbraco2FA/views/Dashboard.html @@ -8,7 +8,7 @@

Umbraco 2FA

You are setup!

- Remove Autenticator + Remove Autenticator

You are NOT setup!

From 42ce111aa2469d6f4dedd3973bb59d9c29a6d381 Mon Sep 17 00:00:00 2001 From: Nick Hoang Date: Thu, 8 Nov 2018 18:08:01 +0700 Subject: [PATCH 2/2] don't override the OwinStartup setting in case the target site had it owns OwinStartup setting --- .../Installer/OwinStartupInstallAction.cs | 19 ++--------------- .../Fortress/Startup/FortressOwinStartup.cs | 21 ++++++++----------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/Umbraco2FA/Umbraco/Fortress/Installer/OwinStartupInstallAction.cs b/Umbraco2FA/Umbraco/Fortress/Installer/OwinStartupInstallAction.cs index a4d1868..8c8aaca 100644 --- a/Umbraco2FA/Umbraco/Fortress/Installer/OwinStartupInstallAction.cs +++ b/Umbraco2FA/Umbraco/Fortress/Installer/OwinStartupInstallAction.cs @@ -16,17 +16,7 @@ public string Alias() } public bool Execute(string packageName, XmlNode xmlData) - { - LogHelper.Debug("Execute"); - - Configuration config = WebConfigurationManager.OpenWebConfiguration("/"); - string oldValue = config.AppSettings.Settings["owin:appStartup"].Value; - if (oldValue == "UmbracoDefaultOwinStartup") - { - LogHelper.Debug("Setting to FortressOwinStartup"); - config.AppSettings.Settings["owin:appStartup"].Value = "FortressOwinStartup"; - config.Save(ConfigurationSaveMode.Modified); - } + { return true; } @@ -39,12 +29,7 @@ public XmlNode SampleXml() } public bool Undo(string packageName, XmlNode xmlData) - { - LogHelper.Debug("Undo"); - - Configuration config = WebConfigurationManager.OpenWebConfiguration("/"); - config.AppSettings.Settings["owin:appStartup"].Value = "UmbracoDefaultOwinStartup"; - config.Save(ConfigurationSaveMode.Modified); + { return true; } } diff --git a/Umbraco2FA/Umbraco/Fortress/Startup/FortressOwinStartup.cs b/Umbraco2FA/Umbraco/Fortress/Startup/FortressOwinStartup.cs index b446b8a..016cb36 100644 --- a/Umbraco2FA/Umbraco/Fortress/Startup/FortressOwinStartup.cs +++ b/Umbraco2FA/Umbraco/Fortress/Startup/FortressOwinStartup.cs @@ -21,20 +21,16 @@ using Microsoft.AspNet.Identity; using Umbraco.Core.Configuration; -[assembly: OwinStartup("FortressOwinStartup", typeof (FortressOwinStartup))] - namespace Orc.Fortress.Startup { - public class FortressOwinStartup : UmbracoDefaultOwinStartup + public class FortressOwinStartup { /// /// Configures services to be created in the OWIN context (CreatePerOwinContext) /// /// - protected override void ConfigureServices(IAppBuilder app) - { - app.SetUmbracoLoggerFactory(); - + public static void ConfigureServices(IAppBuilder app) + { var applicationContext = ApplicationContext.Current; LogHelper.Info(typeof(FortressOwinStartup), "Fortress: Startup"); //Here's where we assign a custom UserManager called MyBackOfficeUserManager @@ -57,14 +53,15 @@ protected override void ConfigureServices(IAppBuilder app) } - - //You don't need to override this unless you plan on implementing custom middleware which you might - protected override void ConfigureMiddleware(IAppBuilder app) + /// + /// You don't need to override this unless you plan on implementing custom middleware which you might + /// + /// + public static void ConfigureMiddleware(IAppBuilder app) { LogHelper.Info(typeof (FortressOwinStartup), "OFFROADCODE: ConfigureMiddleware"); - app.UseTwoFactorSignInCookie(global::Umbraco.Core.Constants.Security.BackOfficeTwoFactorAuthenticationType, TimeSpan.FromMinutes(5)); - base.ConfigureMiddleware(app); + app.UseTwoFactorSignInCookie(global::Umbraco.Core.Constants.Security.BackOfficeTwoFactorAuthenticationType, TimeSpan.FromMinutes(5)); } }