Login/logout updates

This commit is contained in:
Darren Clarke 2025-03-25 10:05:52 +01:00
parent a35d18b5a9
commit 58e713c98b
4 changed files with 20 additions and 21 deletions

View file

@ -27,8 +27,11 @@ type LoginProps = {
}; };
export const Login: FC<LoginProps> = ({ session, baseURL }) => { export const Login: FC<LoginProps> = ({ session, baseURL }) => {
const origin = baseURL; let origin = null;
const callbackUrl = `${origin}/setup`; if (typeof window !== "undefined") {
origin = window.location.origin;
}
const callbackUrl = `${origin}/link`;
const [provider, setProvider] = useState(undefined); const [provider, setProvider] = useState(undefined);
const [email, setEmail] = useState(""); const [email, setEmail] = useState("");
const [password, setPassword] = useState(""); const [password, setPassword] = useState("");
@ -188,7 +191,7 @@ export const Login: FC<LoginProps> = ({ session, baseURL }) => {
sx={buttonStyles} sx={buttonStyles}
onClick={() => onClick={() =>
signIn("azure-ad", { signIn("azure-ad", {
callbackUrl: `${origin}`, callbackUrl,
}) })
} }
> >
@ -225,13 +228,13 @@ export const Login: FC<LoginProps> = ({ session, baseURL }) => {
<Grid item sx={{ width: "100%" }}> <Grid item sx={{ width: "100%" }}>
<IconButton <IconButton
sx={buttonStyles} sx={buttonStyles}
onClick={() => onClick={() => {
signIn("credentials", { signIn("credentials", {
email, email,
password, password,
callbackUrl, callbackUrl,
}) });
} }}
> >
<KeyIcon sx={{ mr: 1 }} /> <KeyIcon sx={{ mr: 1 }} />
Sign in with Zammad credentials Sign in with Zammad credentials

View file

@ -207,10 +207,6 @@ export const Sidebar: FC<SidebarProps> = ({
return () => clearInterval(interval); return () => clearInterval(interval);
}, []); }, []);
const logout = () => {
signOut({ callbackUrl: "/login" });
};
return ( return (
<Drawer <Drawer
sx={{ width: open ? openWidth : closedWidth, flexShrink: 0 }} sx={{ width: open ? openWidth : closedWidth, flexShrink: 0 }}
@ -627,7 +623,6 @@ export const Sidebar: FC<SidebarProps> = ({
Icon={LogoutIcon} Icon={LogoutIcon}
iconSize={20} iconSize={20}
open={open} open={open}
onClick={logout}
/> />
</List> </List>
</Grid> </Grid>

View file

@ -11,7 +11,7 @@ export default function Page() {
headers: { "Content-Type": "application/json" }, headers: { "Content-Type": "application/json" },
credentials: "same-origin", credentials: "same-origin",
}); });
signOut({ callbackUrl: "/login" }); signOut({ callbackUrl: "/link/login" });
}; };
multistepSignOut(); multistepSignOut();
}, []); }, []);

19
package-lock.json generated
View file

@ -97,9 +97,10 @@
} }
}, },
"apps/bridge-whatsapp/node_modules/@whiskeysockets/baileys": { "apps/bridge-whatsapp/node_modules/@whiskeysockets/baileys": {
"version": "6.7.16", "version": "6.17.16",
"resolved": "https://registry.npmjs.org/@whiskeysockets/baileys/-/baileys-6.7.16.tgz", "resolved": "https://registry.npmjs.org/@whiskeysockets/baileys/-/baileys-6.17.16.tgz",
"integrity": "sha512-S999skOvVEBAMqIm5GT+HkQxiX6TjK7iG1Wj9wCUy7vN+hFILOzI8P2SKVuRbhA7W9BLj4S/bWkJRXz/E3z3LA==", "integrity": "sha512-cZoUaKpO4fsDUNiCtyZfbjkW0Bjl/IudzHLCvpqfqtq5TACQzNynYsYdKPJz1I8Cu/SSEvmewk0RorIs0zDWyw==",
"deprecated": "The new official package name for the Baileys package is \"baileys\". Please use that package name going forward. This version may stop receiving updates in the future.",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@adiwajshing/keyed-db": "^0.2.4", "@adiwajshing/keyed-db": "^0.2.4",
@ -4922,9 +4923,9 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.13.12", "version": "22.13.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.12.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz",
"integrity": "sha512-ixiWrCSRi33uqBMRuICcKECW7rtgY43TbsHDpM2XK7lXispd48opW+0IXrBVxv9NMhaz/Ue9kyj6r3NTVyXm8A==", "integrity": "sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~6.20.0" "undici-types": "~6.20.0"
@ -9050,9 +9051,9 @@
} }
}, },
"node_modules/graphile-config/node_modules/@types/node": { "node_modules/graphile-config/node_modules/@types/node": {
"version": "20.17.26", "version": "20.17.27",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.26.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.27.tgz",
"integrity": "sha512-x9T6TLS76RIBGB0X81k+9697cNZel+f/v+BR8gzKNqISC3MhHHWoHY6XIEDY0E8psIJmCEMXqxjw7Np1u/mysA==", "integrity": "sha512-U58sbKhDrthHlxHRJw7ZLiLDZGmAUOZUbpw0S6nL27sYUdhvgBLCRu/keSd6qcTsfArd1sRFCCBxzWATGr/0UA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"undici-types": "~6.19.2" "undici-types": "~6.19.2"