mirror of
				https://github.com/steveiliop56/tinyauth.git
				synced 2025-10-31 06:05:43 +00:00 
			
		
		
		
	fix: correctly redirect to app and check for untrusted redirects
This commit is contained in:
		| @@ -42,7 +42,7 @@ export const ContinuePage = () => { | ||||
|  | ||||
|   const url = new URL(redirectURI); | ||||
|  | ||||
|   if (!(url.hostname == domain) || !url.hostname.endsWith(`.${domain}`)) { | ||||
|   if (!(url.hostname == domain) && !url.hostname.endsWith(`.${domain}`)) { | ||||
|     return ( | ||||
|       <Card className="min-w-xs sm:min-w-sm"> | ||||
|         <CardHeader> | ||||
|   | ||||
| @@ -43,7 +43,10 @@ export const LoginPage = () => { | ||||
|   const isMounted = useIsMounted(); | ||||
|  | ||||
|   const oauthMutation = useMutation({ | ||||
|     mutationFn: (provider: string) => axios.get(`/api/oauth/url/${provider}`), | ||||
|     mutationFn: (provider: string) => | ||||
|       axios.get( | ||||
|         `/api/oauth/url/${provider}?redirect_uri=${encodeURIComponent(redirectUri ?? "")}`, | ||||
|       ), | ||||
|     mutationKey: ["oauth"], | ||||
|     onSuccess: (data) => { | ||||
|       toast.info(t("loginOauthSuccessTitle"), { | ||||
|   | ||||
| @@ -16,7 +16,7 @@ import { Navigate } from "react-router"; | ||||
| import { toast } from "sonner"; | ||||
|  | ||||
| export const LogoutPage = () => { | ||||
|   const { provider, username, isLoggedIn } = useUserContext(); | ||||
|   const { provider, username, isLoggedIn, email } = useUserContext(); | ||||
|   const { genericName } = useAppContext(); | ||||
|   const { t } = useTranslation(); | ||||
|  | ||||
| @@ -56,7 +56,7 @@ export const LogoutPage = () => { | ||||
|                 code: <code />, | ||||
|               }} | ||||
|               values={{ | ||||
|                 username: username, | ||||
|                 username: email, | ||||
|                 provider: | ||||
|                   provider === "generic" ? genericName : capitalize(provider), | ||||
|               }} | ||||
|   | ||||
| @@ -3,8 +3,8 @@ import { z } from "zod"; | ||||
| export const userContextSchema = z.object({ | ||||
|     isLoggedIn: z.boolean(), | ||||
|     username: z.string(), | ||||
|     // name: z.string(), not yet implemented | ||||
|     // email: z.string(), | ||||
|     name: z.string(), | ||||
|     email: z.string(), | ||||
|     provider: z.string(), | ||||
|     oauth: z.boolean(), | ||||
|     totpPending: z.boolean(),     | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Stavros
					Stavros