mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 00:03:33 +10:00
💬 🗃️ ✨user signup source and viral signup links
This commit is contained in:
@ -14,7 +14,7 @@ type FormValues = {
|
|||||||
apiError: string;
|
apiError: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function Signup() {
|
export default function Signup(props: { source: string }) {
|
||||||
const methods = useForm<FormValues>({});
|
const methods = useForm<FormValues>({});
|
||||||
const {
|
const {
|
||||||
register,
|
register,
|
||||||
@ -34,6 +34,7 @@ export default function Signup() {
|
|||||||
.promise(
|
.promise(
|
||||||
fetch("/api/auth/signup", {
|
fetch("/api/auth/signup", {
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
source: props.source,
|
||||||
...data,
|
...data,
|
||||||
}),
|
}),
|
||||||
headers: {
|
headers: {
|
||||||
|
|||||||
@ -6,8 +6,7 @@ import { hashPassword } from "@documenso/lib/auth";
|
|||||||
import { defaultHandler, defaultResponder } from "@documenso/lib/server";
|
import { defaultHandler, defaultResponder } from "@documenso/lib/server";
|
||||||
|
|
||||||
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const data = req.body;
|
const { email, password, source } = req.body;
|
||||||
const { email, password } = data;
|
|
||||||
const cleanEmail = email.toLowerCase();
|
const cleanEmail = email.toLowerCase();
|
||||||
|
|
||||||
if (!cleanEmail || !cleanEmail.includes("@")) {
|
if (!cleanEmail || !cleanEmail.includes("@")) {
|
||||||
@ -46,6 +45,7 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
email: cleanEmail,
|
email: cleanEmail,
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
identityProvider: IdentityProvider.DOCUMENSO,
|
identityProvider: IdentityProvider.DOCUMENSO,
|
||||||
|
source: source,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -67,7 +67,10 @@ const SignPage: NextPageWithLayout = (props: any) => {
|
|||||||
</div>
|
</div>
|
||||||
<p className="mt-4 text-center text-sm text-gray-600">
|
<p className="mt-4 text-center text-sm text-gray-600">
|
||||||
Want to send slick signing links like this one?{" "}
|
Want to send slick signing links like this one?{" "}
|
||||||
<Link href="/signup" className="font-medium text-neon hover:text-neon">
|
<Link
|
||||||
|
href="/signup?source=signed"
|
||||||
|
className="font-medium text-neon hover:text-neon"
|
||||||
|
>
|
||||||
Create your own Account
|
Create your own Account
|
||||||
</Link>
|
</Link>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@ -1,13 +1,23 @@
|
|||||||
|
import { NextPageContext } from "next";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import Signup from "../components/signup";
|
import Signup from "../components/signup";
|
||||||
|
|
||||||
export default function SignupPage() {
|
export default function SignupPage(props: { source: string }) {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Head>
|
<Head>
|
||||||
<title>Signup | Documenso</title>
|
<title>Signup | Documenso</title>
|
||||||
</Head>
|
</Head>
|
||||||
<Signup></Signup>
|
<Signup source={props.source}></Signup>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function getServerSideProps(context: any) {
|
||||||
|
const signupSource: string = context.query["source"];
|
||||||
|
return {
|
||||||
|
props: {
|
||||||
|
source: signupSource ? signupSource : "",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|||||||
@ -15,6 +15,9 @@ export const signingCompleteTemplate = (message: string) => {
|
|||||||
|
|
||||||
<p style="margin-top: 14px;">
|
<p style="margin-top: 14px;">
|
||||||
A copy of the signed document has been attached to this email.
|
A copy of the signed document has been attached to this email.
|
||||||
|
</p>
|
||||||
|
<p style="margin-top: 14px;">
|
||||||
|
<small>Like Documenso? <a href="https://app.documenso.com/signup?source=completemail">Create your own acccount</a>.</small>
|
||||||
</p>`;
|
</p>`;
|
||||||
|
|
||||||
const html = baseEmailTemplate(message, customContent);
|
const html = baseEmailTemplate(message, customContent);
|
||||||
|
|||||||
@ -16,6 +16,9 @@ export const signingRequestTemplate = (
|
|||||||
${ctaLabel}
|
${ctaLabel}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
<p style="margin-top: 14px;">
|
||||||
|
<small>Want to send you own signing links? <a href="https://app.documenso.com/signup?source=signrequest">Create your own acccount</a>.</small>
|
||||||
|
</p>
|
||||||
<hr size="1" style="height:1px;border:none;color:#e0e0e0;background-color:#e0e0e0">
|
<hr size="1" style="height:1px;border:none;color:#e0e0e0;background-color:#e0e0e0">
|
||||||
Click the button to view "${document.title}".<br>
|
Click the button to view "${document.title}".<br>
|
||||||
<small>If you have questions about this document, you should ask ${user.name}.</small>
|
<small>If you have questions about this document, you should ask ${user.name}.</small>
|
||||||
|
|||||||
@ -18,6 +18,7 @@ model User {
|
|||||||
email String @unique
|
email String @unique
|
||||||
emailVerified DateTime?
|
emailVerified DateTime?
|
||||||
password String?
|
password String?
|
||||||
|
source String?
|
||||||
identityProvider IdentityProvider @default(DOCUMENSO)
|
identityProvider IdentityProvider @default(DOCUMENSO)
|
||||||
accounts Account[]
|
accounts Account[]
|
||||||
sessions Session[]
|
sessions Session[]
|
||||||
|
|||||||
Reference in New Issue
Block a user