minor improvements
This commit is contained in:
parent
8786f8b5fe
commit
fc9de564b6
|
@ -23,7 +23,8 @@ export default async function updateUserById(
|
||||||
id: userId,
|
id: userId,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (ssoUser) { // deny changes to SSO-defined properties
|
if (ssoUser) {
|
||||||
|
// deny changes to SSO-defined properties
|
||||||
if (data.email !== user?.email) {
|
if (data.email !== user?.email) {
|
||||||
return {
|
return {
|
||||||
response: "SSO users cannot change their email.",
|
response: "SSO users cannot change their email.",
|
||||||
|
@ -54,8 +55,8 @@ export default async function updateUserById(
|
||||||
status: 400,
|
status: 400,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
} else { // verify only for non-SSO users
|
// verify only for non-SSO users
|
||||||
// SSO users cannot change their email, password, name, username, or avatar
|
// SSO users cannot change their email, password, name, username, or avatar
|
||||||
if (emailEnabled && !data.email)
|
if (emailEnabled && !data.email)
|
||||||
return {
|
return {
|
||||||
|
@ -135,7 +136,10 @@ export default async function updateUserById(
|
||||||
if (data.image?.startsWith("data:image/jpeg;base64")) {
|
if (data.image?.startsWith("data:image/jpeg;base64")) {
|
||||||
if (data.image.length < 1572864) {
|
if (data.image.length < 1572864) {
|
||||||
try {
|
try {
|
||||||
const base64Data = data.image.replace(/^data:image\/jpeg;base64,/, "");
|
const base64Data = data.image.replace(
|
||||||
|
/^data:image\/jpeg;base64,/,
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
createFolder({ filePath: `uploads/avatar` });
|
createFolder({ filePath: `uploads/avatar` });
|
||||||
|
|
||||||
|
@ -163,9 +167,6 @@ export default async function updateUserById(
|
||||||
await prisma.user.findUnique({ where: { id: userId } })
|
await prisma.user.findUnique({ where: { id: userId } })
|
||||||
)?.email;
|
)?.email;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Other settings
|
// Other settings
|
||||||
|
|
||||||
const saltRounds = 10;
|
const saltRounds = 10;
|
||||||
|
@ -184,8 +185,6 @@ export default async function updateUserById(
|
||||||
archiveAsScreenshot: data.archiveAsScreenshot,
|
archiveAsScreenshot: data.archiveAsScreenshot,
|
||||||
archiveAsPDF: data.archiveAsPDF,
|
archiveAsPDF: data.archiveAsPDF,
|
||||||
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
|
archiveAsWaybackMachine: data.archiveAsWaybackMachine,
|
||||||
displayLinkIcons: data.displayLinkIcons,
|
|
||||||
blurredFavicons: data.blurredFavicons,
|
|
||||||
password:
|
password:
|
||||||
data.newPassword && data.newPassword !== ""
|
data.newPassword && data.newPassword !== ""
|
||||||
? newHashedPassword
|
? newHashedPassword
|
||||||
|
|
|
@ -119,6 +119,10 @@ export default function Login({
|
||||||
className=" w-full text-center"
|
className=" w-full text-center"
|
||||||
loading={submitLoader}
|
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 = [];
|
const Buttons: any = [];
|
||||||
availableLogins.buttonAuths.forEach((value, index) => {
|
availableLogins.buttonAuths.forEach((value, index) => {
|
||||||
Buttons.push(
|
Buttons.push(
|
||||||
|
<>
|
||||||
|
{index !== 0 ? <div className="divider my-1">OR</div> : undefined}
|
||||||
|
|
||||||
<AccentSubmitButton
|
<AccentSubmitButton
|
||||||
key={index}
|
key={index}
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -135,6 +142,7 @@ export default function Login({
|
||||||
className=" w-full text-center"
|
className=" w-full text-center"
|
||||||
loading={submitLoader}
|
loading={submitLoader}
|
||||||
/>
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
return Buttons;
|
return Buttons;
|
||||||
|
|
|
@ -59,7 +59,7 @@ export default function Api() {
|
||||||
<div className="divider my-3"></div>
|
<div className="divider my-3"></div>
|
||||||
|
|
||||||
<div className="flex flex-col gap-3">
|
<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
|
Status: Under Development
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ export default function Subscribe() {
|
||||||
Billed {plan === Plan.monthly ? "Monthly" : "Yearly"}
|
Billed {plan === Plan.monthly ? "Monthly" : "Yearly"}
|
||||||
</p>
|
</p>
|
||||||
<fieldset className="w-full flex-col flex justify-evenly px-4 pb-4 pt-1 rounded-md border border-neutral-content">
|
<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
|
Total
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ declare global {
|
||||||
STORAGE_FOLDER?: string;
|
STORAGE_FOLDER?: string;
|
||||||
AUTOSCROLL_TIMEOUT?: string;
|
AUTOSCROLL_TIMEOUT?: string;
|
||||||
RE_ARCHIVE_LIMIT?: string;
|
RE_ARCHIVE_LIMIT?: string;
|
||||||
|
NEXT_PUBLIC_MAX_UPLOAD_SIZE?: string;
|
||||||
|
|
||||||
SPACES_KEY?: string;
|
SPACES_KEY?: string;
|
||||||
SPACES_SECRET?: string;
|
SPACES_SECRET?: string;
|
||||||
|
|
Ŝarĝante…
Reference in New Issue