mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-14 12:16:35 +00:00
feat: allow or block an ip/range of ips using labels (#211)
* feat: allow or block an ip/range of ips using labels * refactor: redirect to root page when no username or ip is provided in the unauthorized page
This commit is contained in:
@@ -17,8 +17,9 @@ export const UnauthorizedPage = () => {
|
||||
const username = searchParams.get("username");
|
||||
const resource = searchParams.get("resource");
|
||||
const groupErr = searchParams.get("groupErr");
|
||||
const ip = searchParams.get("ip");
|
||||
|
||||
if (!username) {
|
||||
if (!username && !ip) {
|
||||
return <Navigate to="/" />;
|
||||
}
|
||||
|
||||
@@ -41,6 +42,10 @@ export const UnauthorizedPage = () => {
|
||||
i18nKey = "unauthorizedGroupsSubtitle";
|
||||
}
|
||||
|
||||
if (ip) {
|
||||
i18nKey = "unauthorizedIpSubtitle";
|
||||
}
|
||||
|
||||
return (
|
||||
<Card className="min-w-xs sm:min-w-sm">
|
||||
<CardHeader>
|
||||
@@ -55,6 +60,7 @@ export const UnauthorizedPage = () => {
|
||||
values={{
|
||||
username,
|
||||
resource,
|
||||
ip,
|
||||
}}
|
||||
/>
|
||||
</CardDescription>
|
||||
|
||||
Reference in New Issue
Block a user