diff --git a/components/sidebar.tsx b/components/sidebar.tsx index 34d2ceb..51fb030 100644 --- a/components/sidebar.tsx +++ b/components/sidebar.tsx @@ -217,13 +217,24 @@ function FooterSection() { return ( footerMenu.map((item, index) => ( -
navigateTo(item.url)} - > - {item.text} -
+ item.roles ? ( + +
navigateTo(item.url)} + > + {item.text} +
+
+ ) : ( +
navigateTo(item.url)} + > + {item.text} +
+ ) )) ); } diff --git a/pages/api/auth/[...nextauth].ts b/pages/api/auth/[...nextauth].ts index 84b4bee..4c6d35f 100644 --- a/pages/api/auth/[...nextauth].ts +++ b/pages/api/auth/[...nextauth].ts @@ -108,18 +108,24 @@ export const authOptions: NextAuthOptions = { } } else { - throw new Error("Не можем да намерим твоя имейл '" + credentials?.username + "' в участниците в ССОМ. Моля свържи се с нас за да те регистрираме ако искаш да ползваш този имейл."); - // console.log("Creating new user in the database..."); - // const passHash = await bcrypt.hash(credentials.password, 10); - // const newUser = await prisma.user.create({ - // data: { - // name: credentials.username, - // email: credentials.username, - // passwordHashLocalAccount: passHash - // } - // }); - // console.log("New user created in the database."); - // return newUser; + const pub = await prisma.publisher.findUnique({ where: { email: credentials.username } }); + if (pub) { + const passHash = await bcrypt.hash(credentials.password, 10); + const newUser = await prisma.user.create({ + data: { + name: credentials.username, + email: credentials.username, + passwordHashLocalAccount: passHash + } + }); + console.log("New local credential user created for publisher ", pub.firstName, " ", pub.lastName, " (", pub.email, ")"); + return newUser; + } + else { + + throw new Error("Не можем да намерим твоя имейл '" + credentials?.username + "' в участниците в ССОМ. Моля свържи се с нас за да те регистрираме ако искаш да ползваш този имейл."); + } + } } } diff --git a/pages/auth/signin.tsx b/pages/auth/signin.tsx index 632f9ae..40ac6b0 100644 --- a/pages/auth/signin.tsx +++ b/pages/auth/signin.tsx @@ -47,13 +47,14 @@ export default function SignIn({ csrfToken }) {
{/* SSO Providers */} -
+
+ {/* Add more buttons for other SSO providers here in similar style */}