From c24cf9dc862a262c81d1a585630d01ca2f5272fb Mon Sep 17 00:00:00 2001 From: BrownKnight Date: Fri, 30 Aug 2024 16:49:15 +0100 Subject: [PATCH] implement a hack to try and make safari/chrome suggest saving the password after submitting the login form --- ui/src/UserContext.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ui/src/UserContext.tsx b/ui/src/UserContext.tsx index 4b9430a..c85735f 100644 --- a/ui/src/UserContext.tsx +++ b/ui/src/UserContext.tsx @@ -62,14 +62,23 @@ export default function UserContextProvider({ children }: React.PropsWithChildre return json.IdToken as string; }; + const onClose = () => { + setIsLoginOpen(false); + // history.pushState({}, "", `${window.location.toString()}#`) + const request = new XMLHttpRequest(); + request.open('POST', '/index.html', true); // use a real url you have instead of '/success.html' + request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8'); + request.send(); + } + return ( {children} {isLoggedIn ? ( - setIsLoginOpen(false)} /> + ) : ( - setIsLoginOpen(false)} setUser={setUser} /> + )} ); @@ -230,7 +239,7 @@ function LoginModal({ -
(type === "login" ? login(e) : register(e))}> + (type === "login" ? login(e) : register(e))} autoComplete="on">