Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Plugin - Authentication.Google - allow to set display order
KrzysztofPajak879ee6879544
diff --git a/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs b/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.csindex 6671acf0e..c54b1a4b3 100644--- a/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs+++ b/src/Plugins/Authentication.Google/Controllers/GoogleAuthenticationController.cs@@ -59,7 +59,8 @@ namespace Authentication.Google.Controllersvar model = new ConfigurationModel{ClientKeyIdentifier = _googleExternalAuthSettings.ClientKeyIdentifier,- ClientSecret = _googleExternalAuthSettings.ClientSecret+ ClientSecret = _googleExternalAuthSettings.ClientSecret,+ DisplayOrder = _googleExternalAuthSettings.DisplayOrder};return View("~/Plugins/Authentication.Google/Views/Configure.cshtml", model);@@ -79,6 +80,8 @@ namespace Authentication.Google.Controllers_googleExternalAuthSettings.ClientKeyIdentifier = model.ClientKeyIdentifier;_googleExternalAuthSettings.ClientSecret = model.ClientSecret;+ _googleExternalAuthSettings.DisplayOrder = model.DisplayOrder;+await _settingService.SaveSetting(_googleExternalAuthSettings);//now clear settings cachediff --git a/src/Plugins/Authentication.Google/GoogleAuthenticationPlugin.cs b/src/Plugins/Authentication.Google/GoogleAuthenticationPlugin.csindex 653caab33..d99852cf6 100644--- a/src/Plugins/Authentication.Google/GoogleAuthenticationPlugin.cs+++ b/src/Plugins/Authentication.Google/GoogleAuthenticationPlugin.cs@@ -58,6 +58,7 @@ namespace Authentication.Googleawait this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.ExternalAuth.Google.Title", "<h4>Configuring Google OAuth2</h4>");await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Externalauth.Google.Failed", "Failed authentication");await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Externalauth.Google.Failed.Errormessage", "Error message: ");+ await this.AddOrUpdatePluginTranslateResource(_translationService, _languageService, "Plugins.Externalauth.Google.DisplayOrder", "Display order");await base.Install();}@@ -78,6 +79,7 @@ namespace Authentication.Googleawait this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.ExternalAuth.Google.ClientSecret");await this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.ExternalAuth.Google.ClientSecret.Hint");await this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.ExternalAuth.Google.Title");+ await this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.ExternalAuth.Google.DisplayOrder");await this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.Externalauth.Google.Failed");await this.DeletePluginTranslationResource(_translationService, _languageService, "Plugins.Externalauth.Google.Failed.Errormessage");diff --git a/src/Plugins/Authentication.Google/GoogleAuthenticationProvider.cs b/src/Plugins/Authentication.Google/GoogleAuthenticationProvider.csindex d3da99028..fc64f1df7 100644--- a/src/Plugins/Authentication.Google/GoogleAuthenticationProvider.cs+++ b/src/Plugins/Authentication.Google/GoogleAuthenticationProvider.cs@@ -6,13 +6,20 @@ namespace Authentication.Google{public class GoogleAuthenticationProvider : IExternalAuthenticationProvider{+ private readonly GoogleExternalAuthSettings _googleExternalAuthSettings;++ public GoogleAuthenticationProvider(GoogleExternalAuthSettings googleExternalAuthSettings)+ {+ _googleExternalAuthSettings = googleExternalAuthSettings;+ }+public string ConfigurationUrl => GoogleAuthenticationDefaults.ConfigurationUrl;public string SystemName => GoogleAuthenticationDefaults.ProviderSystemName;public string FriendlyName => "Google authentication";- public int Priority => -1;+ public int Priority => _googleExternalAuthSettings.DisplayOrder;public IList<string> LimitedToStores => new List<string>();diff --git a/src/Plugins/Authentication.Google/GoogleExternalAuthSettings.cs b/src/Plugins/Authentication.Google/GoogleExternalAuthSettings.csindex 45f9bf26f..86271cfa3 100644--- a/src/Plugins/Authentication.Google/GoogleExternalAuthSettings.cs+++ b/src/Plugins/Authentication.Google/GoogleExternalAuthSettings.cs@@ -6,5 +6,6 @@ namespace Authentication.Google{public string ClientKeyIdentifier { get; set; }public string ClientSecret { get; set; }+ public int DisplayOrder { get; set; }}}diff --git a/src/Plugins/Authentication.Google/Models/ConfigurationModel.cs b/src/Plugins/Authentication.Google/Models/ConfigurationModel.csindex 5ace5fd52..04f3b4d44 100644--- a/src/Plugins/Authentication.Google/Models/ConfigurationModel.cs+++ b/src/Plugins/Authentication.Google/Models/ConfigurationModel.cs@@ -1,10 +1,15 @@-using Grand.Infrastructure.Models;+using Grand.Infrastructure.ModelBinding;+using Grand.Infrastructure.Models;namespace Authentication.Google.Models{public class ConfigurationModel : BaseModel{+ [GrandResourceDisplayName("Plugins.ExternalAuth.Google.ClientKeyIdentifier")]public string ClientKeyIdentifier { get; set; }+ [GrandResourceDisplayName("Plugins.ExternalAuth.Google.ClientSecret")]public string ClientSecret { get; set; }+ [GrandResourceDisplayName("Plugins.Externalauth.Google.DisplayOrder")]+ public int DisplayOrder { get; set; }}}diff --git a/src/Plugins/Authentication.Google/Views/Configure.cshtml b/src/Plugins/Authentication.Google/Views/Configure.cshtmlindex 3f8988b2f..045952c7b 100644--- a/src/Plugins/Authentication.Google/Views/Configure.cshtml+++ b/src/Plugins/Authentication.Google/Views/Configure.cshtml@@ -31,6 +31,15 @@<span asp-validation-for="ClientSecret"></span></div></div>+ <div class="form-group">+ <div class="col-md-3 col-sm-3 text-right">+ <admin-label asp-for="DisplayOrder" class="control-label" />+ </div>+ <div class="col-md-9 col-sm-9">+ <admin-input asp-for="DisplayOrder" />+ <span asp-validation-for="DisplayOrder"></span>+ </div>+ </div></div><div class="panel-footer"><div class="row">