From 908d461552ce97d5ba637c5fe2fc66253ae75d5c Mon Sep 17 00:00:00 2001 From: Paul Schneider Date: Sun, 2 Apr 2023 14:53:31 +0100 Subject: [PATCH] cleanup --- .../new-templates/ViewGenerator/Create.cshtml | 4 +- .../new-templates/ViewGenerator/Delete.cshtml | 4 +- .../ViewGenerator/Details.cshtml | 4 +- .../new-templates/ViewGenerator/Edit.cshtml | 6 +- .../new-templates/ViewGenerator/List.cshtml | 6 +- .../ViewModels/Account/LoginViewModel.cs | 1 + .../Accounting/AccountController.cs | 4 +- src/Yavsc/Helpers/AuthHelpers.cs | 38 ---- src/Yavsc/Startup/Startup.FileServer.cs | 2 +- .../Components/BlogIndex/Default.cshtml | 2 +- src/Yavsc/Yavsc.csproj | 13 +- src/Yavsc/project.json | 195 ------------------ 12 files changed, 28 insertions(+), 251 deletions(-) delete mode 100644 src/Yavsc/Helpers/AuthHelpers.cs delete mode 100644 src/Yavsc/project.json diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml index 12f13963..d212ba9f 100644 --- a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Create.cshtml @@ -9,14 +9,14 @@ else if (Model.IsLayoutPageSelected) { @:@@{ - @:ViewData["Title"] = @@Model.ViewName"]; + @:ViewData["Title"] = @@Model.ViewName; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: -@:

@@Model.ViewName"]

+@:

@@Model.ViewName

@: } else diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml index d8fbd304..1c2dab35 100644 --- a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Delete.cshtml @@ -9,14 +9,14 @@ else if (Model.IsLayoutPageSelected) { @:@@{ - @:ViewData["Title"] = @@Model.ViewName"]; + @:ViewData["Title"] = @@Model.ViewName; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: -@:

@@Model.ViewName"]

+@:

@@Model.ViewName

@: } else diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml index 99024a45..87e0bc5c 100644 --- a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Details.cshtml @@ -9,14 +9,14 @@ else if (Model.IsLayoutPageSelected) { @:@@{ - @:ViewData["Title"] = @@Model.ViewName"]; + @:ViewData["Title"] = @@Model.ViewName; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: -@:

@@Model.ViewName"]

+@:

@@Model.ViewName

@: } else diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml index 12d7b2a5..6437586f 100644 --- a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/Edit.cshtml @@ -9,14 +9,14 @@ else if (Model.IsLayoutPageSelected) { @:@@{ - @:ViewData["Title"] = @@Model.ViewName"]; + @:ViewData["Title"] = @@Model.ViewName; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: -@:

@@Model.ViewName"]

+@:

@@Model.ViewName

@: } else @@ -30,7 +30,7 @@ @: @: @: - @:@@Model.ViewName"] + @:@@Model.ViewName @: @: @: diff --git a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml index 1e52f7fd..a2e66ae2 100644 --- a/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml +++ b/scripts/configure/tools/mvc-code-generators/new-templates/ViewGenerator/List.cshtml @@ -9,14 +9,14 @@ else if (Model.IsLayoutPageSelected) { @:@@{ - @:ViewData["Title"] = @@Model.ViewName"]; + @:ViewData["Title"] = @@Model.ViewName; if (!string.IsNullOrEmpty(Model.LayoutPageFile)) { @:Layout = "@Model.LayoutPageFile"; } @:} @: -@:

@@Model.ViewName"]

+@:

@@Model.ViewName

@: } else @@ -30,7 +30,7 @@ @: @: @: - @:@@Model.ViewName"] + @:@@Model.ViewName @: @: // PushIndent(" "); diff --git a/src/Yavsc.Server/ViewModels/Account/LoginViewModel.cs b/src/Yavsc.Server/ViewModels/Account/LoginViewModel.cs index 59b7ac42..68773a33 100755 --- a/src/Yavsc.Server/ViewModels/Account/LoginViewModel.cs +++ b/src/Yavsc.Server/ViewModels/Account/LoginViewModel.cs @@ -5,6 +5,7 @@ using Yavsc.Attributes.Validation; namespace Yavsc.ViewModels.Account { + // TODO external autentication providers public class SignInViewModel { /// diff --git a/src/Yavsc/Controllers/Accounting/AccountController.cs b/src/Yavsc/Controllers/Accounting/AccountController.cs index f0172228..de1294b4 100644 --- a/src/Yavsc/Controllers/Accounting/AccountController.cs +++ b/src/Yavsc/Controllers/Accounting/AccountController.cs @@ -99,7 +99,6 @@ namespace Yavsc.Controllers return View(new SignInViewModel { ReturnUrl = returnUrl ?? "/", - ExternalProviders = HttpContext.GetExternalProviders() }); /* Note: When using an external login provider, redirect the query : @@ -173,10 +172,10 @@ namespace Yavsc.Controllers else { ModelState.AddModelError(string.Empty, $"Invalid login attempt. ({model.UserName}, {model.Password})"); - model.ExternalProviders = HttpContext.GetExternalProviders(); return this.ViewOk(model); } } + // If we got this far, something failed, redisplay form ModelState.AddModelError(string.Empty, "Unexpected behavior: something failed ... you could try again, or contact me ..."); @@ -212,7 +211,6 @@ namespace Yavsc.Controllers } } - model.ExternalProviders = HttpContext.GetExternalProviders(); return View(model); } diff --git a/src/Yavsc/Helpers/AuthHelpers.cs b/src/Yavsc/Helpers/AuthHelpers.cs deleted file mode 100644 index 826d2714..00000000 --- a/src/Yavsc/Helpers/AuthHelpers.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Linq; -using System.Collections.Generic; -using Microsoft.AspNetCore.Http; -using Yavsc.ViewModels.Account; - -namespace Yavsc.Helpers -{ - public static class HttpContextExtensions { - public static IEnumerable GetExternalProviders(this HttpContext context) { - if (context == null) { - throw new ArgumentNullException(nameof(context)); - } - - return from description in context.GetExternalProviders() - where !string.IsNullOrEmpty(description.DisplayName) - select - ( new YaAuthenticationDescription - { - DisplayName = description.DisplayName, - AuthenticationScheme = description.AuthenticationScheme, - Items = description.Items - });; - } - - public static bool IsProviderSupported(this HttpContext context, string provider) { - if (context == null) { - throw new ArgumentNullException(nameof(context)); - } - - return (from description in context.GetExternalProviders() - where string.Equals(description.AuthenticationScheme, provider, StringComparison.OrdinalIgnoreCase) - select description).Any(); - } - } - - -} diff --git a/src/Yavsc/Startup/Startup.FileServer.cs b/src/Yavsc/Startup/Startup.FileServer.cs index 1c355d3e..e3e13f46 100644 --- a/src/Yavsc/Startup/Startup.FileServer.cs +++ b/src/Yavsc/Startup/Startup.FileServer.cs @@ -91,7 +91,7 @@ namespace Yavsc app.UseFileServer(UserFilesOptions); app.UseFileServer(AvatarsOptions); - + app.UseFileServer(GitOptions); app.UseStaticFiles(); } diff --git a/src/Yavsc/Views/Shared/Components/BlogIndex/Default.cshtml b/src/Yavsc/Views/Shared/Components/BlogIndex/Default.cshtml index 662735af..20ee31e4 100644 --- a/src/Yavsc/Views/Shared/Components/BlogIndex/Default.cshtml +++ b/src/Yavsc/Views/Shared/Components/BlogIndex/Default.cshtml @@ -12,7 +12,7 @@ $("tr.hiddenpost").addClass("hidden"); } }); - + } diff --git a/src/Yavsc/Yavsc.csproj b/src/Yavsc/Yavsc.csproj index a47b1a40..b5af687a 100644 --- a/src/Yavsc/Yavsc.csproj +++ b/src/Yavsc/Yavsc.csproj @@ -7,7 +7,17 @@ - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + @@ -19,6 +29,7 @@ + diff --git a/src/Yavsc/project.json b/src/Yavsc/project.json deleted file mode 100644 index d925c736..00000000 --- a/src/Yavsc/project.json +++ /dev/null @@ -1,195 +0,0 @@ -{ - "version": "1.0.6-*", - "description": "encore une très petite entreprise", - "authors": [ - "Paul Schneider " - ], - "packOptions": { - "repository": { - "type": "git", - "url": "https://github.com/pazof/yavsc" - }, - "licenseUrl": "https://github.com/pazof/yavsc/blob/vnext/LICENSE", - "requireLicenseAcceptance": true, - "owners": [ - "Paul Schneider " - ], - "summary": "Yet another very small company", - "projectUrl": "http://yavsc.pschneider.fr", - "tags": [ - "Blog", - "PoS", - "Chat" - ] - }, - "userSecretsId": "aspnet5-YavscWeb-a0dadd21-2ced-43d3-96f9-7e504345102f", - "exclude": [ - "bin", - "wwwroot", - "node_modules", - "bower_components", - "contrib" - ], - "buildOptions": { - "debugType": "portable", - "emitEntryPoint": false, - "outputName": "Yavsc", - "compile": { - "include": "*.cs", - "exclude": [ - "wwwroot", - "node_modules", - "bower_components", - "contrib", - "Blog-Dev", - "Temp-Dev" - ] - }, - "embed": [ - "Resources/**/*.resx" - ] - }, - "configurations": { - "Debug": { - "compilationOptions": { - "emitEntryPoint": true, - "define": [ - "DEBUG", - "TRACE" - ], - "optimize": false, - "debugType": "full", - "platform": "anycpu" - } - }, - "Release": { - "compilationOptions": { - "define": [ - "RELEASE", - "TRACE" - ], - "optimize": true - } - } - }, - "webroot": "wwwroot", - "tooling": { - "defaultNamespace": "Yavsc" - }, - "dependencies": { - "MarkdownDeep-av.NET": "1.5.27", - "EntityFramework.Commands": "7.0.0-rc1-final", - "EntityFramework.Core": "7.0.0-rc1-final", - "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final", - "EntityFramework.Relational": "7.0.0-rc1-final", - "EntityFramework7.Npgsql": "3.1.0-rc1-3", - "EntityFramework7.Npgsql.Design": "3.1.0-rc1-5", - "MailKit": "1.12.0", - "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final", - "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final", - "Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final", - "Microsoft.AspNet.Authorization": "1.0.0-rc1-final", - "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final", - "Microsoft.AspNet.Http.Abstractions": "1.0.0-rc1-final", - "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-*", - "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-*", - "Microsoft.AspNet.Localization": "1.0.0-rc1-final", - "Microsoft.AspNet.Mvc": "6.0.0-rc1-*", - "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-*", - "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final", - "Microsoft.AspNet.Server.WebListener": "1.0.0-rc1-final", - "Microsoft.AspNet.SignalR.Core": "2.2.1", - "Microsoft.AspNet.SignalR.JS": "2.2.1", - "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-*", - "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-*", - "Microsoft.AspNet.Session": "1.0.0-rc1-final", - "Microsoft.AspNet.Web.Optimization": "1.1.3", - "Microsoft.AspNet.Http.Extensions": "1.0.0-rc1-final", - "Microsoft.AspNet.DataProtection": "1.0.0-rc1-final", - "Microsoft.AspNet.DataProtection.SystemWeb": "1.0.0-rc1-final", - "Microsoft.AspNet.Authentication.OAuth": "1.0.0-rc1-final", - "Microsoft.AspNet.Mvc.Formatters.Json": "6.0.0-rc1-final", - "Microsoft.AspNet.WebSockets.Server": "1.0.0-rc1-final", - "Microsoft.AspNet.OWin": "1.0.0-rc1-final", - "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4", - "Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta8", - "Microsoft.Framework.Configuration.Binder": "1.0.0-beta8", - "Microsoft.Framework.Configuration.Json": "1.0.0-beta8", - "Microsoft.Extensions.Configuration.Abstractions": "1.0.0-rc1-final", - "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final", - "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final", - "Microsoft.Extensions.Logging.TraceSource": "1.0.0-rc1-final", - "Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0-rc1-final", - "Microsoft.Extensions.Globalization.CultureInfoCache": "1.0.0-rc1-final", - "Microsoft.Extensions.Localization": "1.0.0-rc1-final", - "Microsoft.Extensions.Localization.Abstractions": "1.0.0-rc1-final", - "Microsoft.Extensions.PlatformAbstractions": "1.0.0-rc1-final", - "Microsoft.Extensions.WebEncoders.Core": "1.0.0-rc1-final", - "Microsoft.Extensions.Options": "0.0.1-alpha", - "Microsoft.Extensions.WebEncoders": "1.0.0-rc1-final", - "Microsoft.Extensions.CodeGeneration": "1.0.0-rc1-final", - "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final", - "System.Json": "4.0.20126.16343", - "OAuth.AspNet.Token": { - "target": "project", - "type": "build" - }, - "OAuth.AspNet.AuthServer": { - "target": "project", - "type": "build" - }, - "PayPalMerchant-net451": { - "version": "2.7.109" - }, - "Gapi.net45": "1.0.1", - "Yavsc.Abstract": { - "target": "project", - "type": "build" - }, - "Yavsc.Server": { - "target": "project", - "type": "build" - }, - "pazof.rules": "1.1.3" - }, - "commands": { - "ef": "EntityFramework.Commands", - "gen": "Microsoft.Extensions.CodeGeneration", - "yavscpre": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:84", - "lua": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:85", - "yavsc": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:86", - "coiffure": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:88", - "freespeech": "Microsoft.AspNet.Server.Kestrel --server.urls http://*:89", - "web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.Kestrel --server.urls http://*:5000" - }, - "frameworks": { - "dnx451": { - "frameworkAssemblies": { - "System.Drawing": "4.0.0", - "System.Net": "4.0.0.0", - "System.Xml": "4.0.0.0", - "System": "4.0.0.0" - } - } - }, - "publishOptions": { - "exclude": [ - "**.user", - "**.vspscc", - "contrib/**/*.*", - "Blog-Dev/**/*.*", - "Temp-Dev/**/*.*" - ] - }, - "scripts": { - "prepublish": "make minify", - "postrestore": [ - "grep -v '\\.\\.dll' project.lock.json > new.project.lock.json", - "mv new.project.lock.json project.lock.json" - ] - }, - "embed": "Views/**/*.cshtml" -}