minor improvements

This commit is contained in:
daniel31x13 2023-12-07 16:33:01 -05:00
parent 8786f8b5fe
commit fc9de564b6
5 changed files with 432 additions and 424 deletions

View File

@ -23,7 +23,8 @@ export default async function updateUserById(
id: userId,
},
});
if (ssoUser) { // deny changes to SSO-defined properties
if (ssoUser) {
// deny changes to SSO-defined properties
if (data.email !== user?.email) {
return {
response: "SSO users cannot change their email.",
@ -54,8 +55,8 @@ export default async function updateUserById(
status: 400,
};
}
} else { // verify only for non-SSO users
} else {
// verify only for non-SSO users
// SSO users cannot change their email, password, name, username, or avatar
if (emailEnabled && !data.email)
return {
@ -135,7 +136,10 @@ export default async function updateUserById(
if (data.image?.startsWith("data:image/jpeg;base64")) {
if (data.image.length < 1572864) {
try {
const base64Data = data.image.replace(/^data:image\/jpeg;base64,/, "");
const base64Data = data.image.replace(
/^data:image\/jpeg;base64,/,
""
);
createFolder({ filePath: `uploads/avatar` });
@ -163,9 +167,6 @@ export default async function updateUserById(
await prisma.user.findUnique({ where: { id: userId } })
)?.email;
// Other settings
const saltRounds = 10;
@ -184,8 +185,6 @@ export default async function updateUserById(
archiveAsScreenshot: data.archiveAsScreenshot,
archiveAsPDF: data.archiveAsPDF,
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
displayLinkIcons: data.displayLinkIcons,
blurredFavicons: data.blurredFavicons,
password:
data.newPassword && data.newPassword !== ""
? newHashedPassword

View File

@ -119,6 +119,10 @@ export default function Login({
className=" w-full text-center"
loading={submitLoader}
/>
{availableLogins.buttonAuths.length > 0 ? (
<div className="divider my-1">OR</div>
) : undefined}
</>
);
}
@ -127,6 +131,9 @@ export default function Login({
const Buttons: any = [];
availableLogins.buttonAuths.forEach((value, index) => {
Buttons.push(
<>
{index !== 0 ? <div className="divider my-1">OR</div> : undefined}
<AccentSubmitButton
key={index}
type="button"
@ -135,6 +142,7 @@ export default function Login({
className=" w-full text-center"
loading={submitLoader}
/>
</>
);
});
return Buttons;

View File

@ -59,7 +59,7 @@ export default function Api() {
<div className="divider my-3"></div>
<div className="flex flex-col gap-3">
<div className="badge badge-warning rounded-md w-fit p-4">
<div className="badge badge-warning rounded-md w-fit">
Status: Under Development
</div>

View File

@ -84,7 +84,7 @@ export default function Subscribe() {
Billed {plan === Plan.monthly ? "Monthly" : "Yearly"}
</p>
<fieldset className="w-full flex-col flex justify-evenly px-4 pb-4 pt-1 rounded-md border border-neutral-content">
<legend className="w-fit font-extralight px-2 border border-neutral rounded-md text-xl">
<legend className="w-fit font-extralight px-2 border border-neutral-content rounded-md text-xl">
Total
</legend>

View File

@ -9,6 +9,7 @@ declare global {
STORAGE_FOLDER?: string;
AUTOSCROLL_TIMEOUT?: string;
RE_ARCHIVE_LIMIT?: string;
NEXT_PUBLIC_MAX_UPLOAD_SIZE?: string;
SPACES_KEY?: string;
SPACES_SECRET?: string;