Merge pull request #379 from linkwarden/dev

bugs fixed
This commit is contained in:
Daniel 2023-12-30 09:33:39 -05:00 committed by GitHub
commit dea1e12700
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import { useRouter } from "next/router";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
export default function SettingsSidebar({ className }: { className?: string }) { export default function SettingsSidebar({ className }: { className?: string }) {
const LINKWARDEN_VERSION = "v2.4.0"; const LINKWARDEN_VERSION = "v2.4.4";
const { collections } = useCollectionStore(); const { collections } = useCollectionStore();

View File

@ -23,6 +23,7 @@ export default async function updateUserById(
id: userId, id: userId,
}, },
}); });
if (ssoUser) { if (ssoUser) {
// deny changes to SSO-defined properties // deny changes to SSO-defined properties
if (data.email !== user?.email) { if (data.email !== user?.email) {
@ -49,7 +50,7 @@ export default async function updateUserById(
status: 400, status: 400,
}; };
} }
if (data.image !== "") { if (data.image?.startsWith("data:image/jpeg;base64")) {
return { return {
response: "SSO Users cannot change their avatar.", response: "SSO Users cannot change their avatar.",
status: 400, status: 400,

View File

@ -249,7 +249,8 @@ if (process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true") {
profile: (profile) => { profile: (profile) => {
return { return {
id: profile.sub, id: profile.sub,
name: profile.name ?? profile.preferred_username, username: profile.preferred_username,
name: profile.name || "",
email: profile.email, email: profile.email,
image: profile.picture, image: profile.picture,
}; };
@ -589,7 +590,8 @@ if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true") {
profile: (profile) => { profile: (profile) => {
return { return {
id: profile.sub, id: profile.sub,
name: profile.name ?? profile.preferred_username, username: profile.preferred_username,
name: profile.name || "",
email: profile.email, email: profile.email,
image: profile.picture, image: profile.picture,
}; };

View File

@ -3,7 +3,7 @@ import TextInput from "@/components/TextInput";
import CenteredForm from "@/layouts/CenteredForm"; import CenteredForm from "@/layouts/CenteredForm";
import { signIn } from "next-auth/react"; import { signIn } from "next-auth/react";
import Link from "next/link"; import Link from "next/link";
import { useState, FormEvent } from "react"; import React, { useState, FormEvent } from "react";
import { toast } from "react-hot-toast"; import { toast } from "react-hot-toast";
import { getLogins } from "./api/v1/logins"; import { getLogins } from "./api/v1/logins";
import { InferGetServerSidePropsType } from "next"; import { InferGetServerSidePropsType } from "next";
@ -131,18 +131,17 @@ export default function Login({
const Buttons: any = []; const Buttons: any = [];
availableLogins.buttonAuths.forEach((value, index) => { availableLogins.buttonAuths.forEach((value, index) => {
Buttons.push( Buttons.push(
<> <React.Fragment key={index}>
{index !== 0 ? <div className="divider my-1">OR</div> : undefined} {index !== 0 ? <div className="divider my-1">OR</div> : undefined}
<AccentSubmitButton <AccentSubmitButton
key={index}
type="button" type="button"
onClick={() => loginUserButton(value.method)} onClick={() => loginUserButton(value.method)}
label={`Sign in with ${value.name}`} label={`Sign in with ${value.name}`}
className=" w-full text-center" className=" w-full text-center"
loading={submitLoader} loading={submitLoader}
/> />
</> </React.Fragment>
); );
}); });
return Buttons; return Buttons;