mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-11-04 08:05:42 +00:00 
			
		
		
		
	Compare commits
	
		
			2 Commits
		
	
	
		
			v3.0.0-bet
			...
			v3.0.0-bet
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					0f8d2e7fde | ||
| 
						 | 
					0da82ae3fe | 
@@ -24,7 +24,7 @@ Tinyauth is a simple authentication middleware that adds simple username/passwor
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## Discord
 | 
					## Discord
 | 
				
			||||||
 | 
					
 | 
				
			||||||
I just made a Discord server for Tinyauth! It is not only for Tinyauth but general self-hosting because I just like chatting with people! The link is [here](https://discord.gg/gWpzrksk), see you there!
 | 
					I just made a Discord server for Tinyauth! It is not only for Tinyauth but general self-hosting because I just like chatting with people! The link is [here](https://discord.gg/eHzVaCzRRd), see you there!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Getting Started
 | 
					## Getting Started
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import { Navigate } from "react-router";
 | 
				
			|||||||
import { useUserContext } from "../context/user-context";
 | 
					import { useUserContext } from "../context/user-context";
 | 
				
			||||||
import { Layout } from "../components/layouts/layout";
 | 
					import { Layout } from "../components/layouts/layout";
 | 
				
			||||||
import { ReactNode } from "react";
 | 
					import { ReactNode } from "react";
 | 
				
			||||||
 | 
					import { isQueryValid } from "../utils/utils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const ContinuePage = () => {
 | 
					export const ContinuePage = () => {
 | 
				
			||||||
  const queryString = window.location.search;
 | 
					  const queryString = window.location.search;
 | 
				
			||||||
@@ -16,7 +17,7 @@ export const ContinuePage = () => {
 | 
				
			|||||||
    return <Navigate to={`/login?redirect_uri=${redirectUri}`} />;
 | 
					    return <Navigate to={`/login?redirect_uri=${redirectUri}`} />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (redirectUri === "null" || redirectUri === "") {
 | 
					  if (!isQueryValid(redirectUri)) {
 | 
				
			||||||
    return <Navigate to="/" />;
 | 
					    return <Navigate to="/" />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ import { GoogleIcon } from "../icons/google";
 | 
				
			|||||||
import { GithubIcon } from "../icons/github";
 | 
					import { GithubIcon } from "../icons/github";
 | 
				
			||||||
import { OAuthIcon } from "../icons/oauth";
 | 
					import { OAuthIcon } from "../icons/oauth";
 | 
				
			||||||
import { TailscaleIcon } from "../icons/tailscale";
 | 
					import { TailscaleIcon } from "../icons/tailscale";
 | 
				
			||||||
 | 
					import { isQueryValid } from "../utils/utils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const LoginPage = () => {
 | 
					export const LoginPage = () => {
 | 
				
			||||||
  const queryString = window.location.search;
 | 
					  const queryString = window.location.search;
 | 
				
			||||||
@@ -70,7 +71,7 @@ export const LoginPage = () => {
 | 
				
			|||||||
        color: "green",
 | 
					        color: "green",
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
      setTimeout(() => {
 | 
					      setTimeout(() => {
 | 
				
			||||||
        if (redirectUri === "null" || redirectUri === "") {
 | 
					        if (isQueryValid(redirectUri)) {
 | 
				
			||||||
          window.location.replace("/");
 | 
					          window.location.replace("/");
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          window.location.replace(`/continue?redirect_uri=${redirectUri}`);
 | 
					          window.location.replace(`/continue?redirect_uri=${redirectUri}`);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,7 @@
 | 
				
			|||||||
import { Button, Code, Paper, Text } from "@mantine/core";
 | 
					import { Button, Code, Paper, Text } from "@mantine/core";
 | 
				
			||||||
import { Layout } from "../components/layouts/layout";
 | 
					import { Layout } from "../components/layouts/layout";
 | 
				
			||||||
import { Navigate } from "react-router";
 | 
					import { Navigate } from "react-router";
 | 
				
			||||||
 | 
					import { isQueryValid } from "../utils/utils";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const UnauthorizedPage = () => {
 | 
					export const UnauthorizedPage = () => {
 | 
				
			||||||
  const queryString = window.location.search;
 | 
					  const queryString = window.location.search;
 | 
				
			||||||
@@ -8,7 +9,7 @@ export const UnauthorizedPage = () => {
 | 
				
			|||||||
  const username = params.get("username") ?? "";
 | 
					  const username = params.get("username") ?? "";
 | 
				
			||||||
  const resource = params.get("resource") ?? "";
 | 
					  const resource = params.get("resource") ?? "";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (username === "null" || username === "") {
 | 
					  if (!isQueryValid(username)) {
 | 
				
			||||||
    return <Navigate to="/" />;
 | 
					    return <Navigate to="/" />;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -20,7 +21,7 @@ export const UnauthorizedPage = () => {
 | 
				
			|||||||
        </Text>
 | 
					        </Text>
 | 
				
			||||||
        <Text>
 | 
					        <Text>
 | 
				
			||||||
          The user with username <Code>{username}</Code> is not authorized to{" "}
 | 
					          The user with username <Code>{username}</Code> is not authorized to{" "}
 | 
				
			||||||
          {resource !== "null" && resource !== "" ? (
 | 
					          {isQueryValid(resource) ? (
 | 
				
			||||||
            <span>
 | 
					            <span>
 | 
				
			||||||
              access the <Code>{resource}</Code> resource.
 | 
					              access the <Code>{resource}</Code> resource.
 | 
				
			||||||
            </span>
 | 
					            </span>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1,2 @@
 | 
				
			|||||||
export const capitalize = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
 | 
					export const capitalize = (s: string) => s.charAt(0).toUpperCase() + s.slice(1);
 | 
				
			||||||
 | 
					export const isQueryValid = (value: string) => value.trim() !== "" && value !== "null";
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user