Compare commits

...

5 Commits

Author SHA1 Message Date
Daniel 74399c1708 Merge pull request #383 from linkwarden/dev
update version number
2023-12-31 08:03:36 -05:00
daniel31x13 1dde8a6088 update version number 2023-12-31 08:03:15 -05:00
daniel31x13 e872c25332 small improvement + better error handling 2023-12-31 07:55:45 -05:00
Daniel dea1e12700 Merge pull request #379 from linkwarden/dev
bugs fixed
2023-12-30 09:33:39 -05:00
daniel31x13 055869883a bugs fixed 2023-12-30 09:31:53 -05:00
8 changed files with 24 additions and 12 deletions
+1 -1
View File
@@ -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.5";
const { collections } = useCollectionStore();
+4 -1
View File
@@ -68,7 +68,10 @@ export default async function postLink(
const validatedUrl = link.url ? await validateUrlSize(link.url) : undefined;
if (validatedUrl === null)
return { response: "File is too large to be stored.", status: 400 };
return {
response: "Something went wrong while retrieving the file size.",
status: 400,
};
const contentType = validatedUrl?.get("content-type");
let linkType = "url";
@@ -5,6 +5,9 @@ import Stripe from "stripe";
import { DeleteUserBody } from "@/types/global";
import removeFile from "@/lib/api/storage/removeFile";
const keycloakEnabled = process.env.KEYCLOAK_CLIENT_SECRET;
const authentikEnabled = process.env.AUTHENTIK_CLIENT_SECRET;
export default async function deleteUserById(
userId: number,
body: DeleteUserBody
@@ -22,7 +25,7 @@ export default async function deleteUserById(
}
// Then, we check if the provided password matches the one stored in the database (disabled in Keycloak integration)
if (!process.env.KEYCLOAK_CLIENT_SECRET) {
if (!keycloakEnabled && !authentikEnabled) {
const isPasswordValid = bcrypt.compareSync(
body.password,
user.password as string
@@ -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,
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "linkwarden",
"version": "2.4.0",
"version": "2.4.5",
"main": "index.js",
"repository": "https://github.com/linkwarden/linkwarden.git",
"author": "Daniel31X13 <daniel31x13@gmail.com>",
+5 -2
View File
@@ -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,13 +590,15 @@ 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,
};
},
})
);
const _linkAccount = adapter.linkAccount;
adapter.linkAccount = (account) => {
const { "not-before-policy": _, refresh_expires_in, ...data } = account;
+3 -4
View File
@@ -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(
<>
<React.Fragment key={index}>
{index !== 0 ? <div className="divider my-1">OR</div> : undefined}
<AccentSubmitButton
key={index}
type="button"
onClick={() => loginUserButton(value.method)}
label={`Sign in with ${value.name}`}
className=" w-full text-center"
loading={submitLoader}
/>
</>
</React.Fragment>
);
});
return Buttons;
+4 -1
View File
@@ -5,6 +5,9 @@ import CenteredForm from "@/layouts/CenteredForm";
import { signOut, useSession } from "next-auth/react";
import Link from "next/link";
const keycloakEnabled = process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED === "true";
const authentikEnabled = process.env.NEXT_PUBLIC_AUTHENTIK_ENABLED === "true";
export default function Delete() {
const [password, setPassword] = useState("");
const [comment, setComment] = useState<string>();
@@ -23,7 +26,7 @@ export default function Delete() {
},
};
if (process.env.NEXT_PUBLIC_KEYCLOAK_ENABLED !== "true" && password == "") {
if (!keycloakEnabled && !authentikEnabled && password == "") {
return toast.error("Please fill the required fields.");
}