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

View file

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

View file

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

19
package-lock.json generated
View file

@ -97,9 +97,10 @@
}
},
"apps/bridge-whatsapp/node_modules/@whiskeysockets/baileys": {
"version": "6.7.16",
"resolved": "https://registry.npmjs.org/@whiskeysockets/baileys/-/baileys-6.7.16.tgz",
"integrity": "sha512-S999skOvVEBAMqIm5GT+HkQxiX6TjK7iG1Wj9wCUy7vN+hFILOzI8P2SKVuRbhA7W9BLj4S/bWkJRXz/E3z3LA==",
"version": "6.17.16",
"resolved": "https://registry.npmjs.org/@whiskeysockets/baileys/-/baileys-6.17.16.tgz",
"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",
"dependencies": {
"@adiwajshing/keyed-db": "^0.2.4",
@ -4922,9 +4923,9 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.13.12",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.12.tgz",
"integrity": "sha512-ixiWrCSRi33uqBMRuICcKECW7rtgY43TbsHDpM2XK7lXispd48opW+0IXrBVxv9NMhaz/Ue9kyj6r3NTVyXm8A==",
"version": "22.13.13",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz",
"integrity": "sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"
@ -9050,9 +9051,9 @@
}
},
"node_modules/graphile-config/node_modules/@types/node": {
"version": "20.17.26",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.26.tgz",
"integrity": "sha512-x9T6TLS76RIBGB0X81k+9697cNZel+f/v+BR8gzKNqISC3MhHHWoHY6XIEDY0E8psIJmCEMXqxjw7Np1u/mysA==",
"version": "20.17.27",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.17.27.tgz",
"integrity": "sha512-U58sbKhDrthHlxHRJw7ZLiLDZGmAUOZUbpw0S6nL27sYUdhvgBLCRu/keSd6qcTsfArd1sRFCCBxzWATGr/0UA==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.19.2"