-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7215 from abpframework/maliming/AccessDenied
Add Access denied page to Account module.
- Loading branch information
Showing
6 changed files
with
51 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@page | ||
@model Volo.Abp.Account.Web.Pages.Account.AccessDeniedModel | ||
@using Microsoft.AspNetCore.Mvc.Localization | ||
@using Volo.Abp.Account.Localization | ||
@inject IHtmlLocalizer<AccountResource> L | ||
|
||
<div class="card mt-3 shadow-sm rounded"> | ||
<div class="card-body p-5"> | ||
<h4>@L["AccessDenied"]</h4> | ||
<form method="post" class="mt-4"> | ||
<p>@L["AccessDeniedMessage"]</p> | ||
<a abp-button="Primary" asp-page="./Login" asp-all-route-data="@(new Dictionary<string, string> {{"returnUrl", Model.ReturnUrl}, {"returnUrlHash", Model.ReturnUrlHash}})">← @L["BackToLogin"]</a> | ||
</form> | ||
</div> | ||
</div> |
24 changes: 24 additions & 0 deletions
24
modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace Volo.Abp.Account.Web.Pages.Account | ||
{ | ||
public class AccessDeniedModel : AccountPageModel | ||
{ | ||
[BindProperty(SupportsGet = true)] | ||
public string ReturnUrl { get; set; } | ||
|
||
[BindProperty(SupportsGet = true)] | ||
public string ReturnUrlHash { get; set; } | ||
|
||
public virtual Task<IActionResult> OnGetAsync() | ||
{ | ||
return Task.FromResult<IActionResult>(Page()); | ||
} | ||
|
||
public virtual Task<IActionResult> OnPostAsync() | ||
{ | ||
return Task.FromResult<IActionResult>(Page()); | ||
} | ||
} | ||
} |