Middleware javítás

This commit is contained in:
2025-03-21 09:57:07 +01:00
parent 6dcc4989ac
commit efecf55dd8
3 changed files with 15 additions and 5 deletions
@@ -32,6 +32,13 @@ namespace WorkFlowCheck.Web.Middleware
{ {
context.Response.Cookies.Delete("AuthToken"); context.Response.Cookies.Delete("AuthToken");
} }
var path = context.Request.Path.ToString().ToLower();
if (!path.StartsWith("/account/login") && !path.StartsWith("/account/register"))
{
context.Response.Redirect("/Account/Login");
return;
}
} }
await _next(context); await _next(context);
} }
@@ -1,3 +1,4 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity.Data; using Microsoft.AspNetCore.Identity.Data;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.RazorPages;
@@ -7,6 +8,7 @@ using WorkFlowCheck.Web.Services.Interfaces;
namespace WorkFlowCheck.Web.Pages.Account namespace WorkFlowCheck.Web.Pages.Account
{ {
[AllowAnonymous]
public class LoginModel : PageModel public class LoginModel : PageModel
{ {
@@ -72,11 +72,12 @@
}, },
data: JSON.stringify(formData.CheckListTemplateRow), data: JSON.stringify(formData.CheckListTemplateRow),
success: function (response) { success: function (response) {
showMessageModal({ // showMessageModal({
title: 'Figyelmem!', // title: 'Figyelmem!',
message: 'Sikeres mentés.', // message: 'Sikeres mentés.',
okText: 'Értettem' // okText: 'Értettem'
}); // });
history.back();
}, },
error: function (xhr, status, error) { error: function (xhr, status, error) {
// Hiba esetén // Hiba esetén