Skip to content

Commit c254c09

Browse files
committed
Changes to make the forms make sense when an admin is editing another account
1 parent 9897c80 commit c254c09

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

src/commands/members/change-primary-email-form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const renderForm = (viewModel: ViewModel) =>
1919
pipe(
2020
html`
2121
<h1>Change primary email</h1>
22-
<form action="?next=/me" method="post">
22+
<form action="?next=/member/${viewModel.memberNumber}" method="post">
2323
<label for="email">Email address</label>
2424
<input
2525
type="email"

src/commands/members/send-email-verification-form.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,24 @@ type ViewModel = {
1313
user: User;
1414
memberNumber: number;
1515
emailAddress: string;
16+
isSelf: boolean;
1617
};
1718

1819
const renderForm = (viewModel: ViewModel) =>
1920
pipe(
20-
html`
21+
viewModel.isSelf
22+
? html`<p>
23+
In order to finish adding an email to your profile it needs to be verified. Click the button below
24+
to send an email with a verification link to '${sanitizeString(viewModel.emailAddress)}'
25+
</p>`
26+
: html`<p>
27+
In order to finish adding an email to this profile (member number ${viewModel.memberNumber}) it needs to be verified.
28+
Click the button below to send an email with a verification link to '${sanitizeString(viewModel.emailAddress)}'
29+
</p>`,
30+
(description) => html`
2131
<h1>Send email verification</h1>
22-
<p>
23-
In order to finish adding an email to your profile it needs to be verified. Click the button below
24-
to send an email with a verification link to '${sanitizeString(viewModel.emailAddress)}'
25-
</p>
26-
<form action="?next=/me" method="post">
32+
${description}
33+
<form action="?next=/member/${viewModel.memberNumber}" method="post">
2734
<input
2835
type="hidden"
2936
name="email"
@@ -66,6 +73,7 @@ const constructForm: Form<ViewModel>['constructForm'] =
6673
user,
6774
memberNumber: params.member,
6875
emailAddress: params.email,
76+
isSelf: user.memberNumber === params.member
6977
}))
7078
);
7179

0 commit comments

Comments
 (0)