mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
✨ 🗃️ expires signign request after 60 days
This commit is contained in:
@ -3,6 +3,10 @@ import Head from "next/head";
|
||||
import { NextPageWithLayout } from "../../_app";
|
||||
import { ReadStatus } from "@prisma/client";
|
||||
import PDFSigner from "../../../components/editor/pdf-signer";
|
||||
import Logo from "../../../components/logo";
|
||||
import Link from "next/link";
|
||||
import { Button } from "@documenso/ui";
|
||||
import { CheckBadgeIcon, ClockIcon } from "@heroicons/react/24/outline";
|
||||
|
||||
const SignPage: NextPageWithLayout = (props: any) => {
|
||||
return (
|
||||
@ -10,7 +14,49 @@ const SignPage: NextPageWithLayout = (props: any) => {
|
||||
<Head>
|
||||
<title>Sign | Documenso</title>
|
||||
</Head>
|
||||
{!props.expired ? (
|
||||
<PDFSigner document={props.document} fields={props.fields} />
|
||||
) : (
|
||||
<>
|
||||
<div className="mx-auto w-fit px-4 py-16 sm:px-6 sm:py-24 lg:px-8">
|
||||
<ClockIcon className="text-neon w-10 inline mr-1"></ClockIcon>
|
||||
<h1 className="text-base font-medium text-neon inline align-middle">
|
||||
Time flies.
|
||||
</h1>
|
||||
<p className="mt-2 text-4xl font-bold tracking-tight">
|
||||
This signing link is expired.
|
||||
</p>
|
||||
<p className="mt-2 text-base text-gray-500">
|
||||
Please ask{" "}
|
||||
{props.document.User.name
|
||||
? `${props.document.User.name}`
|
||||
: `the sender`}{" "}
|
||||
to resend it.
|
||||
</p>
|
||||
<div className="mx-auto w-fit text-xl pt-20"></div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="relative mx-96">
|
||||
<div
|
||||
className="absolute inset-0 flex items-center"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<div className="w-full border-t border-gray-300" />
|
||||
</div>
|
||||
<div className="relative flex justify-center"></div>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mt-4 text-center text-sm text-gray-600">
|
||||
Want to send of your own?{" "}
|
||||
<Link
|
||||
href="/signup?source=expired"
|
||||
className="font-medium text-neon hover:text-neon"
|
||||
>
|
||||
Create your own Account
|
||||
</Link>
|
||||
</p>
|
||||
</>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
@ -34,7 +80,7 @@ export async function getServerSideProps(context: any) {
|
||||
token: recipientToken,
|
||||
},
|
||||
include: {
|
||||
Document: true,
|
||||
Document: { include: { User: true } },
|
||||
},
|
||||
});
|
||||
|
||||
@ -61,8 +107,11 @@ export async function getServerSideProps(context: any) {
|
||||
|
||||
return {
|
||||
props: {
|
||||
document: recipient.Document,
|
||||
fields: unsignedFields,
|
||||
document: JSON.parse(JSON.stringify(recipient.Document)),
|
||||
fields: JSON.parse(JSON.stringify(unsignedFields)),
|
||||
expired: recipient.expired
|
||||
? new Date(recipient.expired) < new Date()
|
||||
: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
@ -23,11 +23,19 @@ export const sendSigningRequest = async (
|
||||
).catch((err) => {
|
||||
throw err;
|
||||
});
|
||||
|
||||
const expiryDate = new Date();
|
||||
expiryDate.setDate(expiryDate.getDate() + 60);
|
||||
|
||||
await prisma.recipient.update({
|
||||
where: {
|
||||
id: recipient.id,
|
||||
},
|
||||
data: { sendStatus: SendStatus.SENT, readStatus: ReadStatus.NOT_OPENED },
|
||||
data: {
|
||||
sendStatus: SendStatus.SENT,
|
||||
readStatus: ReadStatus.NOT_OPENED,
|
||||
expired: expiryDate,
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.document.update({
|
||||
|
||||
@ -91,6 +91,7 @@ model Recipient {
|
||||
email String @db.VarChar(255)
|
||||
name String @default("") @db.VarChar(255)
|
||||
token String
|
||||
expired DateTime?
|
||||
readStatus ReadStatus @default(NOT_OPENED)
|
||||
signingStatus SigningStatus @default(NOT_SIGNED)
|
||||
sendStatus SendStatus @default(NOT_SENT)
|
||||
|
||||
Reference in New Issue
Block a user