fix translation, improve email clarity

This commit is contained in:
Tom Moor committed 2024-12-17 16:48:28 +09:00
1 parent 65356a7b73
commit f539f2d04c
4 files changed
+20 -14

No files matched your search

+5 -4
View File
@@ -7,6 +7,7 @@ import ConfirmationDialog from "~/components/ConfirmationDialog";
import Input from "~/components/Input";
import useStores from "~/hooks/useStores";
import { client } from "~/utils/ApiClient";
import Text from "./Text";
type Props = {
user: User;
@@ -160,12 +161,12 @@ export function UserChangeEmailDialog({ user, onSubmit }: Props) {
savingText={`${t("Saving")}…`}
disabled={!email || email === user.email}
>
<Trans>
<p>
<Text as="p">
<Trans>
You will receive an email to verify your new address. It must be
unique in the workspace.
</p>
</Trans>
</Trans>
</Text>
<Input
type="email"
name="email"
+11 -8
View File
@@ -11,6 +11,7 @@ import Heading from "./components/Heading";
type Props = EmailProps & {
code: string;
teamUrl: string;
};
/**
@@ -29,17 +30,17 @@ export default class ConfirmUpdateEmail extends BaseEmail<Props> {
return `Here’s your email change confirmation.`;
}
protected renderAsText({ code }: Props): string {
protected renderAsText({ teamUrl, code, to }: Props): string {
return `
You requested to update your ${env.APP_NAME} account email. Please
follow the link below to confirm the change.
follow the link below to confirm the change to ${to}.
${this.updateLink(code)}
${this.updateLink(teamUrl, code)}
`;
}
protected render({ code }: Props) {
protected render({ teamUrl, code, to }: Props) {
return (
<EmailTemplate previewText={this.preview()}>
<Header />
@@ -48,11 +49,13 @@ follow the link below to confirm the change.
<Heading>Your email update request</Heading>
<p>
You requested to update your {env.APP_NAME} account email. Please
click below to confirm the change.
click below to confirm the change to <strong>{to}</strong>.
</p>
<EmptySpace height={5} />
<p>
<Button href={this.updateLink(code)}>Confirm Change</Button>
<Button href={this.updateLink(teamUrl, code)}>
Confirm Change
</Button>
</p>
</Body>
@@ -61,7 +64,7 @@ follow the link below to confirm the change.
);
}
private updateLink(code: string): string {
return `${env.URL}/api/users.updateEmail?code=${code}`;
private updateLink(teamUrl: string, code: string): string {
return `${teamUrl}/api/users.updateEmail?code=${code}`;
}
}
+3 -1
View File
@@ -212,13 +212,14 @@ router.post(
async (ctx: APIContext<T.UsersUpdateEmailReq>) => {
const { user: actor } = ctx.state.auth;
const { id } = ctx.input.body;
const { team } = actor;
const user = id ? await User.findByPk(id) : actor;
const email = ctx.input.body.email.trim().toLowerCase();
authorize(actor, "update", user);
// Check if email domain is allowed
if (!(await actor.team.isDomainAllowed(email))) {
if (!(await team.isDomainAllowed(email))) {
throw DomainNotAllowedError();
}
@@ -230,6 +231,7 @@ router.post(
await new ConfirmUpdateEmail({
to: email,
code: user.getEmailUpdateToken(email),
teamUrl: team.url,
}).schedule();
ctx.body = {
+1 -1
View File
@@ -403,7 +403,7 @@
"New name": "New name",
"Name can't be empty": "Name can't be empty",
"Check your email to verify the new address.": "Check your email to verify the new address.",
"<0>You will receive an email to verify your new address. It must be unique in the workspace.</0>": "<0>You will receive an email to verify your new address. It must be unique in the workspace.</0>",
"You will receive an email to verify your new address. It must be unique in the workspace.": "You will receive an email to verify your new address. It must be unique in the workspace.",
"New email": "New email",
"Email can't be empty": "Email can't be empty",
"Your import completed": "Your import completed",