Skip to content

Commit

Permalink
Merge pull request #7215 from abpframework/maliming/AccessDenied
Browse files Browse the repository at this point in the history
Add Access denied page to Account module.
  • Loading branch information
hikalkan authored Jan 17, 2021
2 parents a9bde97 + bafc809 commit 0bcadec
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
"Volo.Account:InvalidEmailAddress": "找不到给定的电子邮件地址:{0}",
"PasswordReset": "重设密码",
"PasswordResetInfoInEmail": "我们收到了帐户恢复请求!如果你发起了此请求,请单击以下链接以重置密码.",
"ResetMyPassword": "重置我的密码"
"ResetMyPassword": "重置我的密码",
"AccessDenied": "拒绝访问!",
"AccessDeniedMessage": "你无权访问此资源."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
"ReturnToApplication": "返回到應用程序",
"PasswordReset": "重設密碼",
"PasswordResetInfoInEmail": "我們收到了帳戶恢復請求!如果你發起了此請求,請單擊以下鏈接以重置密碼.",
"ResetMyPassword": "重置我的密碼"
"ResetMyPassword": "重置我的密碼",
"AccessDenied": "拒絕訪問!",
"AccessDeniedMessage": "您無權訪問此資源."
}
}
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}})">&larr; @L["BackToLogin"]</a>
</form>
</div>
</div>
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());
}
}
}

0 comments on commit 0bcadec

Please sign in to comment.