Browse Source

Add Access denied page to Account module.

Resolve #7207
pull/7215/head
maliming 5 years ago
parent
commit
bafc809dcf
  1. 4
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json
  2. 4
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json
  3. 4
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json
  4. 4
      modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json
  5. 15
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml
  6. 24
      modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs

4
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/en.json

@ -60,6 +60,8 @@
"Volo.Account:InvalidEmailAddress": "Can not find the given email address: {0}",
"PasswordReset": "Password reset",
"PasswordResetInfoInEmail": "We received an account recovery request! If you initiated this request, click the following link to reset your password.",
"ResetMyPassword": "Reset my password"
"ResetMyPassword": "Reset my password",
"AccessDenied": "Access denied!",
"AccessDeniedMessage": "You do not have access to this resource."
}
}

4
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/tr.json

@ -60,6 +60,8 @@
"Volo.Account:InvalidEmailAddress": "Email adresi bulunamadı: {0}",
"PasswordReset": "Şifre Sıfırlama",
"PasswordResetInfoInEmail": "Şifrenizi sıfırlamanız için bir talep aldık! Eğer bu talebi siz gerçekleştirmişseniz, şifrenizi sıfırlamak için bağlantıya tıklayın.",
"ResetMyPassword": "Şifremi sıfırla"
"ResetMyPassword": "Şifremi sıfırla",
"AccessDenied": "Erişim reddedildi!",
"AccessDeniedMessage": "Bu kaynağa erişiminiz yok."
}
}

4
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hans.json

@ -60,6 +60,8 @@
"Volo.Account:InvalidEmailAddress": "找不到给定的电子邮件地址:{0}",
"PasswordReset": "重设密码",
"PasswordResetInfoInEmail": "我们收到了帐户恢复请求!如果你发起了此请求,请单击以下链接以重置密码.",
"ResetMyPassword": "重置我的密码"
"ResetMyPassword": "重置我的密码",
"AccessDenied": "拒绝访问!",
"AccessDeniedMessage": "你无权访问此资源."
}
}

4
modules/account/src/Volo.Abp.Account.Application.Contracts/Volo/Abp/Account/Localization/Resources/zh-Hant.json

@ -58,6 +58,8 @@
"ReturnToApplication": "返回到應用程序",
"PasswordReset": "重設密碼",
"PasswordResetInfoInEmail": "我們收到了帳戶恢復請求!如果你發起了此請求,請單擊以下鏈接以重置密碼.",
"ResetMyPassword": "重置我的密碼"
"ResetMyPassword": "重置我的密碼",
"AccessDenied": "拒絕訪問!",
"AccessDeniedMessage": "您無權訪問此資源."
}
}

15
modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml

@ -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}})">&larr; @L["BackToLogin"]</a>
</form>
</div>
</div>

24
modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccessDenied.cshtml.cs

@ -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());
}
}
}
Loading…
Cancel
Save