mirror of
https://github.com/linkwarden/linkwarden.git
synced 2026-03-03 03:47:02 +00:00
improvements
This commit is contained in:
@@ -37,7 +37,8 @@ export default async function postUser(
|
||||
};
|
||||
}
|
||||
|
||||
const { name, email, password, invite } = dataValidation.data;
|
||||
const { name, email, password, invite, acceptPromotionalEmails } =
|
||||
dataValidation.data;
|
||||
let { username } = dataValidation.data;
|
||||
|
||||
if (invite && (!stripeEnabled || !emailEnabled)) {
|
||||
@@ -109,6 +110,7 @@ export default async function postUser(
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
acceptPromotionalEmails: acceptPromotionalEmails || false,
|
||||
dashboardSections: {
|
||||
createMany: {
|
||||
data: [
|
||||
|
||||
@@ -15,6 +15,7 @@ import { i18n } from "next-i18next.config";
|
||||
import { Trans, useTranslation } from "next-i18next";
|
||||
import { useConfig } from "@linkwarden/router/config";
|
||||
import { Separator } from "@/components/ui/separator";
|
||||
import Checkbox from "@/components/Checkbox";
|
||||
|
||||
type FormData = {
|
||||
name: string;
|
||||
@@ -22,6 +23,7 @@ type FormData = {
|
||||
email?: string;
|
||||
password: string;
|
||||
passwordConfirmation: string;
|
||||
acceptPromotionalEmails: boolean;
|
||||
};
|
||||
|
||||
export default function Register({
|
||||
@@ -39,6 +41,7 @@ export default function Register({
|
||||
email: config?.EMAIL_PROVIDER ? "" : undefined,
|
||||
password: "",
|
||||
passwordConfirmation: "",
|
||||
acceptPromotionalEmails: false,
|
||||
});
|
||||
|
||||
async function registerUser(event: FormEvent<HTMLFormElement>) {
|
||||
@@ -251,27 +254,41 @@ export default function Register({
|
||||
</div>
|
||||
|
||||
{process.env.NEXT_PUBLIC_STRIPE && (
|
||||
<div className="text-xs text-neutral mb-3">
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="sign_up_agreement"
|
||||
components={[
|
||||
<Link
|
||||
href="https://linkwarden.app/tos"
|
||||
className="font-semibold"
|
||||
data-testid="terms-of-service-link"
|
||||
key={0}
|
||||
/>,
|
||||
<Link
|
||||
href="https://linkwarden.app/privacy-policy"
|
||||
className="font-semibold"
|
||||
data-testid="privacy-policy-link"
|
||||
key={1}
|
||||
/>,
|
||||
]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
<>
|
||||
<Checkbox
|
||||
className="p-0"
|
||||
label={t("accept_promotional_emails")}
|
||||
state={form.acceptPromotionalEmails}
|
||||
onClick={(e) =>
|
||||
setForm({
|
||||
...form,
|
||||
acceptPromotionalEmails: e.target.checked,
|
||||
})
|
||||
}
|
||||
/>
|
||||
|
||||
<div className="text-xs text-neutral mb-3">
|
||||
<p>
|
||||
<Trans
|
||||
i18nKey="sign_up_agreement"
|
||||
components={[
|
||||
<Link
|
||||
href="https://linkwarden.app/tos"
|
||||
className="font-semibold"
|
||||
data-testid="terms-of-service-link"
|
||||
key={0}
|
||||
/>,
|
||||
<Link
|
||||
href="https://linkwarden.app/privacy-policy"
|
||||
className="font-semibold"
|
||||
data-testid="privacy-policy-link"
|
||||
key={1}
|
||||
/>,
|
||||
]}
|
||||
/>
|
||||
</p>
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
|
||||
<Button
|
||||
|
||||
@@ -520,5 +520,6 @@
|
||||
"create_your_first_collection": "Create Your First Collection!",
|
||||
"create_your_first_collection_desc": "Collections are like folders for your Links which can then be shared with others.",
|
||||
"this_tag_has_no_links": "This Tag Has No Links",
|
||||
"this_tag_has_no_links_desc": "Use this Tag while creating or editing Links!"
|
||||
"this_tag_has_no_links_desc": "Use this Tag while creating or editing Links!",
|
||||
"accept_promotional_emails": "Get notified about new features and offers via email."
|
||||
}
|
||||
|
||||
@@ -52,7 +52,8 @@ export const PostUserSchema = () => {
|
||||
.min(3)
|
||||
.max(50)
|
||||
.regex(/^[a-z0-9_-]{3,50}$/),
|
||||
invite: z.boolean().optional(),
|
||||
invite: z.boolean().default(false),
|
||||
acceptPromotionalEmails: z.boolean().default(false),
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" ADD COLUMN "acceptPromotionalEmails" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -68,6 +68,7 @@ model User {
|
||||
referredBy String?
|
||||
dashboardSections DashboardSection[]
|
||||
lastPickedAt DateTime?
|
||||
acceptPromotionalEmails Boolean @default(false)
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @default(now()) @updatedAt
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user