Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: verify email before downloading application #4000

Open
wants to merge 39 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
40c1f2d
Redirect download link to basic verify email page
jamdelion Nov 21, 2024
766abcc
try to download application file on email submit - no verification
jamdelion Nov 21, 2024
56f08cc
Merge branch 'main' into jh/verify-email-page
jamdelion Nov 25, 2024
aff54ca
Fix global import problem
jamdelion Nov 25, 2024
e660026
Works with permission error
jamdelion Nov 25, 2024
99a447c
Use existing endpoint to check email address
jamdelion Nov 25, 2024
1c07974
Move helper to utils file
jamdelion Nov 25, 2024
08e62da
Use react query
jamdelion Nov 25, 2024
e39f856
Lint fix
jamdelion Nov 25, 2024
2ad7978
Tidy up
jamdelion Nov 25, 2024
139c1d9
Add test todos
jamdelion Nov 26, 2024
5de9aa2
Fix typing
jamdelion Nov 26, 2024
03454a3
Display errors nicely
jamdelion Nov 27, 2024
4260930
Fix error wrapper type issue
jamdelion Nov 28, 2024
725ea12
Revert moving urlWithParams
jamdelion Dec 2, 2024
fbcca1f
Update wording to be more appropriate
jamdelion Dec 2, 2024
db050b0
Rename files to verifySubmissionEmail
jamdelion Dec 2, 2024
795497a
Rename url to download-application
jamdelion Dec 2, 2024
e7c5171
Merge branch 'main' into jh/verify-email-page
jamdelion Dec 3, 2024
ce3b34a
Replace react-query with axios
jamdelion Dec 3, 2024
810c7e4
Readd loading state
jamdelion Dec 3, 2024
6c183e4
Add application summary
jamdelion Dec 3, 2024
ea18fcf
Add one more test.todo
jamdelion Dec 3, 2024
2147de4
Remove react query
jamdelion Dec 3, 2024
a0e28f8
Remove queryProvider
jamdelion Dec 3, 2024
c58ef33
Remove rq lint plugin
jamdelion Dec 3, 2024
570df3d
Remove rq from test utils
jamdelion Dec 3, 2024
868c820
Use correct zip filename
jamdelion Dec 4, 2024
2b8c421
Move application summary and capitalise team name
jamdelion Dec 10, 2024
60cd604
Wrap verifySubmissionPage in PlanX headers
jamdelion Dec 10, 2024
d35c7da
Revert error typing
jamdelion Dec 10, 2024
9d9e967
Merge branch 'main' into jh/verify-email-page
jamdelion Jan 6, 2025
8aa35df
Merge branch 'main' into jh/verify-email-page
jamdelion Jan 8, 2025
88f1252
Merge branch 'main' into jh/verify-email-page
jamdelion Jan 13, 2025
cc6b34c
Account for recent changes to searchParams
jamdelion Jan 13, 2025
e577c01
lint
jamdelion Jan 13, 2025
bc746c0
Merge branch 'main' into jh/verify-email-page
jamdelion Feb 3, 2025
7df63e7
test: verify email component (#4019)
jamdelion Feb 7, 2025
cf098d9
Merge branch 'main' into jh/verify-email-page
jamdelion Feb 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api.planx.uk/modules/send/downloadApplicationFiles/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export async function downloadApplicationFiles(
const { teamSettings } = await getTeamEmailSettings(
req.query.localAuthority as string,
);
if (teamSettings.submissionEmail !== req.query.email) {
const decodedEmail = decodeURIComponent(req.query.email as string);
if (teamSettings.submissionEmail !== decodedEmail) {
return next({
status: 403,
message:
Expand Down
9 changes: 2 additions & 7 deletions api.planx.uk/modules/send/email/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,15 @@ export const sendToEmail: SendIntegrationController = async (
const { email, flow } = await getSessionEmailDetailsById(sessionId);
const flowName = flow.name;

// Make application files download magic link
const params = new URLSearchParams({
email: teamSettings.submissionEmail,
localAuthority: localAuthority,
});
const applicationFilesDownloadLink = `${process.env.API_URL_EXT}/download-application-files/${sessionId}?${params}`;
const serviceURL = `${process.env.EDITOR_URL_EXT}/${localAuthority}/${flow.slug}/${sessionId}`;

// Prepare email template
const config: EmailSubmissionNotifyConfig = {
personalisation: {
serviceName: flowName,
sessionId,
applicantEmail: email,
downloadLink: applicationFilesDownloadLink,
downloadLink: `${serviceURL}/download-application`, // send to verifySubmissionEmail page
...teamSettings,
},
};
Expand Down
4 changes: 2 additions & 2 deletions api.planx.uk/modules/send/email/service.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { gql } from "graphql-request";
import { $api } from "../../../client/index.js";
import type {
Session,
TeamContactSettings,
} from "@opensystemslab/planx-core/types";
import { gql } from "graphql-request";
import { $api } from "../../../client/index.js";
import type { EmailSubmissionNotifyConfig } from "../../../types.js";

interface GetTeamEmailSettings {
Expand Down
1 change: 1 addition & 0 deletions editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
"jest-environment-jsdom": "^29.7.0",
"jest-localstorage-mock": "^2.4.26",
"lint-staged": "^13.2.3",
"msw": "^2.7.0",
"postcss": "^8.4.32",
"prettier": "^3.0.0",
"react-refresh": "^0.14.0",
Expand Down
Loading
Loading