Equipment is kész.
This commit is contained in:
@@ -75,8 +75,16 @@ app.UseAuthorization();
|
||||
|
||||
app.Use(async (context, next) =>
|
||||
{
|
||||
if (string.IsNullOrEmpty(context.User?.Identity?.Name) &&
|
||||
context.Request.Path == "/")
|
||||
//if (string.IsNullOrEmpty(context.User?.Identity?.Name) &&
|
||||
// context.Request.Path == "/")
|
||||
//{
|
||||
// context.Response.Redirect("/Account/Login");
|
||||
// return;
|
||||
//}
|
||||
var isAuthenticated = context.User?.Identity?.IsAuthenticated == true;
|
||||
var path = context.Request.Path.Value?.ToLower();
|
||||
|
||||
if (!isAuthenticated && !path.StartsWith("/account/login"))
|
||||
{
|
||||
context.Response.Redirect("/Account/Login");
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user