Compare commits
2 Commits
46257d0de4
...
bc74e0c376
| Author | SHA1 | Date | |
|---|---|---|---|
| bc74e0c376 | |||
| ddfe628977 |
@@ -2,6 +2,7 @@
|
||||
@using BlazorBootstrap;
|
||||
@using HerramientaCASA.Model
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@@ -115,4 +116,23 @@
|
||||
Navigation.NavigateTo("/", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
|
||||
string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
@using HerramientaCASA.Model
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@inject UserState UserState
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
|
||||
|
||||
<head>
|
||||
@@ -37,4 +39,23 @@
|
||||
|
||||
@code{
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
|
||||
string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
@using HerramientaCASA.Model
|
||||
@using Microsoft.AspNetCore.Components.Web
|
||||
@inherits LayoutComponentBase
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@@ -121,4 +122,23 @@
|
||||
? "nav-link headNav active"
|
||||
: "nav-link headNav";
|
||||
}
|
||||
|
||||
|
||||
protected override void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
string? urlAnterior = HttpContextAccessor.HttpContext?.Request.Headers["Referer"].ToString();
|
||||
string rutaActual = Navigation.ToBaseRelativePath(Navigation.Uri);
|
||||
|
||||
if (rutaActual != "Denegado")
|
||||
{
|
||||
if (string.IsNullOrEmpty(urlAnterior) || urlAnterior.Contains("cacoa.es"))
|
||||
{
|
||||
Navigation.NavigateTo("/Denegado", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
32
HerramientaCASA/Components/Pages/Login/Denegado.razor
Normal file
32
HerramientaCASA/Components/Pages/Login/Denegado.razor
Normal file
@@ -0,0 +1,32 @@
|
||||
@page "/Denegado"
|
||||
@using HerramientaCASA.Model
|
||||
@using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage
|
||||
@inject ProtectedLocalStorage ProtectedLocalStore
|
||||
@rendermode InteractiveServer
|
||||
@layout LoginLayout
|
||||
@inject IHttpContextAccessor HttpContextAccessor
|
||||
@inject NavigationManager Navigation
|
||||
@inject UserState UserState
|
||||
|
||||
|
||||
<div class="fondo">
|
||||
<div class="back">
|
||||
<div class="div-center">
|
||||
<div class="d-block mt-4">
|
||||
<img src="Content/Imagenes/CACOA-6.png" height="49" />
|
||||
<h4 class="mt-2">Acceso Denegado</h4>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<p class="form-text">
|
||||
Se ha agotado la sesión o se ha accedido a la aplicación desde fuera de la Web del CACOA.<br />
|
||||
Por favor vuelva a acceder desde la web
|
||||
</p>
|
||||
</div>
|
||||
<a href="https://www.cacoa.es" class="enlaceCACOA">Ir a la web del CACOA</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
}
|
||||
Reference in New Issue
Block a user