From 055869883a896640a4e901a33343407c739078e8 Mon Sep 17 00:00:00 2001 From: daniel31x13 Date: Sat, 30 Dec 2023 09:31:53 -0500 Subject: [PATCH] bugs fixed --- components/SettingsSidebar.tsx | 2 +- lib/api/controllers/users/userId/updateUserById.ts | 3 ++- pages/api/v1/auth/[...nextauth].ts | 6 ++++-- pages/login.tsx | 7 +++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/SettingsSidebar.tsx b/components/SettingsSidebar.tsx index d1d1eb0..9b4ec13 100644 --- a/components/SettingsSidebar.tsx +++ b/components/SettingsSidebar.tsx @@ -4,7 +4,7 @@ import { useRouter } from "next/router"; import React, { useEffect, useState } from "react"; export default function SettingsSidebar({ className }: { className?: string }) { - const LINKWARDEN_VERSION = "v2.4.0"; + const LINKWARDEN_VERSION = "v2.4.4"; const { collections } = useCollectionStore(); diff --git a/lib/api/controllers/users/userId/updateUserById.ts b/lib/api/controllers/users/userId/updateUserById.ts index 0868845..285e44e 100644 --- a/lib/api/controllers/users/userId/updateUserById.ts +++ b/lib/api/controllers/users/userId/updateUserById.ts @@ -23,6 +23,7 @@ export default async function updateUserById( id: userId, }, }); + if (ssoUser) { // deny changes to SSO-defined properties if (data.email !== user?.email) { @@ -49,7 +50,7 @@ export default async function updateUserById( status: 400, }; } - if (data.image !== "") { + if (data.image?.startsWith("data:image/jpeg;base64")) { return { response: "SSO Users cannot change their avatar.", status: 400, diff --git a/pages/api/v1/auth/[...nextauth].ts b/pages/api/v1/auth/[...nextauth].ts index 40ee66c..0db48d6 100644 --- a/pages/api/v1/auth/[...nextauth].ts +++ b/pages/api/v1/auth/[...nextauth].ts @@ -249,7 +249,8 @@ if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true") { profile: (profile) => { return { id: profile.sub, - name: profile.name ?? profile.preferred_username, + username: profile.preferred_username, + name: profile.name || "", email: profile.email, image: profile.picture, }; @@ -589,7 +590,8 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true") { profile: (profile) => { return { id: profile.sub, - name: profile.name ?? profile.preferred_username, + username: profile.preferred_username, + name: profile.name || "", email: profile.email, image: profile.picture, }; diff --git a/pages/login.tsx b/pages/login.tsx index 2cccc7b..796da86 100644 --- a/pages/login.tsx +++ b/pages/login.tsx @@ -3,7 +3,7 @@ import TextInput from "@/components/TextInput"; import CenteredForm from "@/layouts/CenteredForm"; import { signIn } from "next-auth/react"; import Link from "next/link"; -import { useState, FormEvent } from "react"; +import React, { useState, FormEvent } from "react"; import { toast } from "react-hot-toast"; import { getLogins } from "./api/v1/logins"; import { InferGetServerSidePropsType } from "next"; @@ -131,18 +131,17 @@ export default function Login({ const Buttons: any = []; availableLogins.buttonAuths.forEach((value, index) => { Buttons.push( - <> + {index !== 0 ?
OR
: undefined} loginUserButton(value.method)} label={`Sign in with ${value.name}`} className=" w-full text-center" loading={submitLoader} /> - +
); }); return Buttons;