mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
💬 🗃️ ✨user signup source and viral signup links
This commit is contained in:
@ -14,7 +14,7 @@ type FormValues = {
|
||||
apiError: string;
|
||||
};
|
||||
|
||||
export default function Signup() {
|
||||
export default function Signup(props: { source: string }) {
|
||||
const methods = useForm<FormValues>({});
|
||||
const {
|
||||
register,
|
||||
@ -34,6 +34,7 @@ export default function Signup() {
|
||||
.promise(
|
||||
fetch("/api/auth/signup", {
|
||||
body: JSON.stringify({
|
||||
source: props.source,
|
||||
...data,
|
||||
}),
|
||||
headers: {
|
||||
|
||||
@ -6,8 +6,7 @@ import { hashPassword } from "@documenso/lib/auth";
|
||||
import { defaultHandler, defaultResponder } from "@documenso/lib/server";
|
||||
|
||||
async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
const data = req.body;
|
||||
const { email, password } = data;
|
||||
const { email, password, source } = req.body;
|
||||
const cleanEmail = email.toLowerCase();
|
||||
|
||||
if (!cleanEmail || !cleanEmail.includes("@")) {
|
||||
@ -46,6 +45,7 @@ async function postHandler(req: NextApiRequest, res: NextApiResponse) {
|
||||
email: cleanEmail,
|
||||
password: hashedPassword,
|
||||
identityProvider: IdentityProvider.DOCUMENSO,
|
||||
source: source,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@ -67,7 +67,10 @@ const SignPage: NextPageWithLayout = (props: any) => {
|
||||
</div>
|
||||
<p className="mt-4 text-center text-sm text-gray-600">
|
||||
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
|
||||
</Link>
|
||||
</p>
|
||||
|
||||
@ -1,13 +1,23 @@
|
||||
import { NextPageContext } from "next";
|
||||
import Head from "next/head";
|
||||
import Signup from "../components/signup";
|
||||
|
||||
export default function SignupPage() {
|
||||
export default function SignupPage(props: { source: string }) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>Signup | Documenso</title>
|
||||
</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;">
|
||||
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>`;
|
||||
|
||||
const html = baseEmailTemplate(message, customContent);
|
||||
|
||||
@ -16,6 +16,9 @@ export const signingRequestTemplate = (
|
||||
${ctaLabel}
|
||||
</a>
|
||||
</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">
|
||||
Click the button to view "${document.title}".<br>
|
||||
<small>If you have questions about this document, you should ask ${user.name}.</small>
|
||||
|
||||
@ -18,6 +18,7 @@ model User {
|
||||
email String @unique
|
||||
emailVerified DateTime?
|
||||
password String?
|
||||
source String?
|
||||
identityProvider IdentityProvider @default(DOCUMENSO)
|
||||
accounts Account[]
|
||||
sessions Session[]
|
||||
|
||||
Reference in New Issue
Block a user