mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-27 01:34:01 -04:00
Compare commits
467 Commits
0df04cfd89
...
05-07-2025
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5cd703eb2f | ||
|
|
2c08d638a0 | ||
|
|
b9e08a5bc8 | ||
|
|
540ee74243 | ||
|
|
ac69799108 | ||
|
|
15dcf7474f | ||
|
|
39972c341a | ||
|
|
5887c1cf5c | ||
|
|
35176328ca | ||
|
|
e64446f5be | ||
|
|
a9901fc951 | ||
|
|
eb3780e5b6 | ||
|
|
d5131c61f9 | ||
|
|
b9c50c1e5d | ||
|
|
000b2b7819 | ||
|
|
34ed31d611 | ||
|
|
c844a6bed8 | ||
|
|
566228d051 | ||
|
|
f79bb3d95a | ||
|
|
c87a5d6bc6 | ||
|
|
7fef3fff26 | ||
|
|
eff92773cc | ||
|
|
f771f2374d | ||
|
|
0e48ed2716 | ||
|
|
149d8e3ce5 | ||
|
|
e5dce090e6 | ||
|
|
4b138711e2 | ||
|
|
824364f2b6 | ||
|
|
50bdf916ba | ||
|
|
285bee3809 | ||
|
|
8e28cdbb56 | ||
|
|
02023aa775 | ||
|
|
2adb87dfe4 | ||
|
|
43548a823e | ||
|
|
db4c02532a | ||
|
|
598e5eca91 | ||
|
|
b48377e4b4 | ||
|
|
ccdfd0c10e | ||
|
|
0917ddaa23 | ||
|
|
7fbed553aa | ||
|
|
0710372db4 | ||
|
|
db7d59c8c8 | ||
|
|
c5228d9557 | ||
|
|
eb2d4798bd | ||
|
|
3ed99ccd45 | ||
|
|
b91e687d17 | ||
|
|
5eb08b8042 | ||
|
|
aa59ac1d9c | ||
|
|
c825878c45 | ||
|
|
e6b76486f4 | ||
|
|
69ae1ea0e1 | ||
|
|
b468620ead | ||
|
|
4279467b16 | ||
|
|
f0ff50eb63 | ||
|
|
86b4547499 | ||
|
|
a6145bec19 | ||
|
|
1c795253d4 | ||
|
|
6c16482577 | ||
|
|
bf03391b6d | ||
|
|
e04806b1eb | ||
|
|
7410a00519 | ||
|
|
fb20ea6e1c | ||
|
|
cd40580231 | ||
|
|
b78a430ef9 | ||
|
|
7a52290bb7 | ||
|
|
4b5fee0bba | ||
|
|
350526f4ad | ||
|
|
fb5f7d969e | ||
|
|
2d6afb7904 | ||
|
|
670d82b72c | ||
|
|
ec7af325df | ||
|
|
23782a83d0 | ||
|
|
609c472cff | ||
|
|
386b3f8348 | ||
|
|
8bf58cdca9 | ||
|
|
6b92941156 | ||
|
|
0ccbe17b3b | ||
|
|
ae305227bb | ||
|
|
7130925b9a | ||
|
|
f484a9c432 | ||
|
|
6f6402e36a | ||
|
|
714e5011c3 | ||
|
|
6bfa9ede76 | ||
|
|
57023b3a3a | ||
|
|
0e31d34672 | ||
|
|
1b9e19072e | ||
|
|
55dc8e31ca | ||
|
|
f9a08dffe0 | ||
|
|
f661ea39ca | ||
|
|
431dbb10dd | ||
|
|
25524324c5 | ||
|
|
5abc0a4c8e | ||
|
|
3328853bd0 | ||
|
|
d6baaebef8 | ||
|
|
b6a6ffb2ab | ||
|
|
b01a62225e | ||
|
|
522340f52b | ||
|
|
fe42f5ef64 | ||
|
|
b4afcb07aa | ||
|
|
5d3364a114 | ||
|
|
70b149476c | ||
|
|
4a1ac9b85c | ||
|
|
10c61440c9 | ||
|
|
34fdf7a1ca | ||
|
|
20cbb0a8db | ||
|
|
14024a28ca | ||
|
|
280e348fa6 | ||
|
|
72f36a4d15 | ||
|
|
0b866aa7a7 | ||
|
|
77e9475ed8 | ||
|
|
b4e239c9bb | ||
|
|
c016530a7d | ||
|
|
2779e398f6 | ||
|
|
8dfa881f26 | ||
|
|
5f258cb699 | ||
|
|
a53df8998c | ||
|
|
e3843f33c6 | ||
|
|
20e0dc6c3e | ||
|
|
e9029eef09 | ||
|
|
d0d6113a05 | ||
|
|
232c6cb9e1 | ||
|
|
ed238bfe6f | ||
|
|
a3eeeb2b2c | ||
|
|
54d8996e2a | ||
|
|
88e9f1dec6 | ||
|
|
7de1a9b944 | ||
|
|
b4a8eb7210 | ||
|
|
f975953aa7 | ||
|
|
34b39acf38 | ||
|
|
3e0e290dc0 | ||
|
|
8c32af4ee1 | ||
|
|
5464da155a | ||
|
|
01678ce67a | ||
|
|
67b7dc28b4 | ||
|
|
d4a2584dfb | ||
|
|
638a4f20da | ||
|
|
fbd70b7c38 | ||
|
|
06ce617f0a | ||
|
|
1afe8121b8 | ||
|
|
9d7b6d3147 | ||
|
|
7b2d031591 | ||
|
|
ae3be157e6 | ||
|
|
16b1429eb0 | ||
|
|
64ac382af9 | ||
|
|
ca1e87a54b | ||
|
|
da695557b0 | ||
|
|
3e18c8f595 | ||
|
|
d3e17c743b | ||
|
|
6d398f7301 | ||
|
|
e96f01f4a9 | ||
|
|
9eec7cdba5 | ||
|
|
e59ddfcae5 | ||
|
|
38d8bdea0a | ||
|
|
f8eb512aab | ||
|
|
6dd44fdc2d | ||
|
|
1967195da0 | ||
|
|
fb11fbfba3 | ||
|
|
17a7080f46 | ||
|
|
a962da9c7d | ||
|
|
3a468c77aa | ||
|
|
d8ca53e08b | ||
|
|
bea926f103 | ||
|
|
6f8f7346ca | ||
|
|
8dbcc59726 | ||
|
|
f3c3a60875 | ||
|
|
253934a495 | ||
|
|
fff81870e5 | ||
|
|
970483ef0b | ||
|
|
ba661a0c53 | ||
|
|
f5ce055079 | ||
|
|
29c2eafbd7 | ||
|
|
6ecbc7ebab | ||
|
|
f3688d62d5 | ||
|
|
1f13176fa6 | ||
|
|
09c6d0445d | ||
|
|
c328353e18 | ||
|
|
e9e0601237 | ||
|
|
88f29a6727 | ||
|
|
9d4d55a670 | ||
|
|
3211c5a16f | ||
|
|
9c8aa9c0e2 | ||
|
|
c2508f7230 | ||
|
|
b5675e586e | ||
|
|
823b490331 | ||
|
|
e69d6f807f | ||
|
|
ee8213f670 | ||
|
|
c43174be78 | ||
|
|
548072fe66 | ||
|
|
7f3e368427 | ||
|
|
caed2ad5d6 | ||
|
|
3401b994cd | ||
|
|
d5798bb818 | ||
|
|
0cf9abf5e8 | ||
|
|
0bdf0cb073 | ||
|
|
b8b7c2df69 | ||
|
|
2ca7f5d2b0 | ||
|
|
db37a4de94 | ||
|
|
b3b31d0732 | ||
|
|
ef779daec1 | ||
|
|
50df9c79a2 | ||
|
|
e4a4217dba | ||
|
|
3179471122 | ||
|
|
f8c7f6b817 | ||
|
|
193184983d | ||
|
|
38451d77ad | ||
|
|
032b9927aa | ||
|
|
82934daa02 | ||
|
|
1c2c9fd57a | ||
|
|
417356bc28 | ||
|
|
f379e828de | ||
|
|
7a29252081 | ||
|
|
06c238269f | ||
|
|
91f3e6a557 | ||
|
|
2064fc864a | ||
|
|
273232df40 | ||
|
|
c1e1e34a17 | ||
|
|
7e4947389c | ||
|
|
bf9537ccd4 | ||
|
|
4225470b1e | ||
|
|
c49d998f9e | ||
|
|
c9d9c7a3a6 | ||
|
|
35a2d940a0 | ||
|
|
e1c6d41f78 | ||
|
|
e419d843a6 | ||
|
|
c01a6a84f3 | ||
|
|
7cd8be22f6 | ||
|
|
f9dd331421 | ||
|
|
78b30e3d76 | ||
|
|
bd4e1d751a | ||
|
|
f71b03a45c | ||
|
|
f1ccbe6f52 | ||
|
|
bbe1e44366 | ||
|
|
685deebae4 | ||
|
|
918016d4af | ||
|
|
f87f0a1c9e | ||
|
|
869f76c846 | ||
|
|
3946e7bb3a | ||
|
|
56ee7ec376 | ||
|
|
5dad9e8f0f | ||
|
|
23c5d7aff1 | ||
|
|
d2dd249b61 | ||
|
|
3e410ba5b2 | ||
|
|
f55d47e3d1 | ||
|
|
7813ce7914 | ||
|
|
a1802a3439 | ||
|
|
8897b30b81 | ||
|
|
5741c572f0 | ||
|
|
b0d8eda0f4 | ||
|
|
97b8f70c1f | ||
|
|
e007571ac8 | ||
|
|
9e5475cd43 | ||
|
|
6eaa471a5c | ||
|
|
6e72bc7f5e | ||
|
|
21980d2bdf | ||
|
|
f4bc6d4531 | ||
|
|
a5200220e2 | ||
|
|
8f45eeb2cf | ||
|
|
b134a68845 | ||
|
|
4b910bec88 | ||
|
|
96890199f3 | ||
|
|
238a281512 | ||
|
|
cafd7d75b7 | ||
|
|
f246cc7c51 | ||
|
|
d92e2a7c04 | ||
|
|
94b791c869 | ||
|
|
700c76807b | ||
|
|
e0e8c56a61 | ||
|
|
d79ece2d01 | ||
|
|
0108bcf91f | ||
|
|
7458acdab1 | ||
|
|
c7e3d777ac | ||
|
|
ec45db1ea4 | ||
|
|
9bed7d4253 | ||
|
|
8c56a75af7 | ||
|
|
d9eebb4f64 | ||
|
|
6546acf434 | ||
|
|
bd77775286 | ||
|
|
132ced0042 | ||
|
|
7922004f9a | ||
|
|
3a38ea2db6 | ||
|
|
3af8f782ec | ||
|
|
cbb1288345 | ||
|
|
96c033cd6f | ||
|
|
5d43ec2bb6 | ||
|
|
fff5caee1f | ||
|
|
6cfb15106e | ||
|
|
5507891d8f | ||
|
|
1a5f255539 | ||
|
|
7e2a2bad8e | ||
|
|
5c7a8913b0 | ||
|
|
52a11945a1 | ||
|
|
79ea3a3ac9 | ||
|
|
88ff982c0d | ||
|
|
77c97eeb0b | ||
|
|
5d4394bfda | ||
|
|
7485162411 | ||
|
|
d16c0c5153 | ||
|
|
5144b90f22 | ||
|
|
418a868e18 | ||
|
|
3a38b8bf31 | ||
|
|
04f4f2e990 | ||
|
|
9efe503353 | ||
|
|
012dc4fae6 | ||
|
|
35f3203e9c | ||
|
|
cb4cfeb610 | ||
|
|
15103c99b5 | ||
|
|
6dd8b3cfe0 | ||
|
|
fe098eca22 | ||
|
|
0ca31c1ed1 | ||
|
|
78ee70b0c1 | ||
|
|
71b7c745db | ||
|
|
da194d358c | ||
|
|
a539fcbef6 | ||
|
|
a5ddf8038b | ||
|
|
06d0581bc9 | ||
|
|
937aa5af15 | ||
|
|
b5203f473a | ||
|
|
dc03a3f0d1 | ||
|
|
7afdf7336a | ||
|
|
606b124912 | ||
|
|
bab13de934 | ||
|
|
c05beb42f2 | ||
|
|
2049fd5c76 | ||
|
|
1d911c4d44 | ||
|
|
bc83fab764 | ||
|
|
051114157d | ||
|
|
cac7d1452a | ||
|
|
f9ea913b00 | ||
|
|
9a8a80ab14 | ||
|
|
707768d749 | ||
|
|
d05bf1e9e0 | ||
|
|
da081679c1 | ||
|
|
61c37687a2 | ||
|
|
8bc6df5d35 | ||
|
|
e84e3efed3 | ||
|
|
fdceb3cbdb | ||
|
|
26c695c21e | ||
|
|
b4907fd2fb | ||
|
|
f13ab20e93 | ||
|
|
9404a09dfa | ||
|
|
fda16b7ce9 | ||
|
|
3ae05a37c9 | ||
|
|
0df8b37646 | ||
|
|
cb334c0dcd | ||
|
|
1cd51a8257 | ||
|
|
3b8fdd8122 | ||
|
|
43c0d6244a | ||
|
|
fbf0fb1f0d | ||
|
|
965db9cd7e | ||
|
|
3555db1163 | ||
|
|
f820ae86f3 | ||
|
|
47657d45ed | ||
|
|
fab1ef6d45 | ||
|
|
10fb9f9b35 | ||
|
|
02a188a080 | ||
|
|
9facde2c60 | ||
|
|
592ea83ea2 | ||
|
|
dd0d5d3b33 | ||
|
|
29373d41ca | ||
|
|
55225018b6 | ||
|
|
5a1b656d7e | ||
|
|
46e43b6fbd | ||
|
|
542ce8ec00 | ||
|
|
371fbb2cd4 | ||
|
|
41dcedd48f | ||
|
|
d64d84ff4a | ||
|
|
558753037f | ||
|
|
821265cf6e | ||
|
|
236fafd597 | ||
|
|
22d643acb1 | ||
|
|
ff65471084 | ||
|
|
310ec3eae6 | ||
|
|
9e8aec4c5d | ||
|
|
de67e441f9 | ||
|
|
e3b35b5b83 | ||
|
|
21408543d4 | ||
|
|
aff028b24c | ||
|
|
a652c5f321 | ||
|
|
06814cd0a5 | ||
|
|
dd7d32e51c | ||
|
|
a5d66f02b5 | ||
|
|
505e5792d2 | ||
|
|
f73fe7fc9a | ||
|
|
aa3d5757f1 | ||
|
|
85ae22a81a | ||
|
|
ae619fff64 | ||
|
|
9f88a3d84f | ||
|
|
f828193a5c | ||
|
|
bc9d8969fb | ||
|
|
7ab59b9d4a | ||
|
|
b7673ae673 | ||
|
|
cee9b751bf | ||
|
|
7b39aa4761 | ||
|
|
6a224528a5 | ||
|
|
56440b4477 | ||
|
|
0a75856c2d | ||
|
|
59da570302 | ||
|
|
714473b829 | ||
|
|
ee04cae75c | ||
|
|
113f86b312 | ||
|
|
224c25a193 | ||
|
|
adf37eb4d0 | ||
|
|
e6ded78be8 | ||
|
|
f6952b28de | ||
|
|
3408cf0bd8 | ||
|
|
8f0daa19b8 | ||
|
|
59f766bb1e | ||
|
|
ec2b55c171 | ||
|
|
3fbbc4d57e | ||
|
|
32c797e10b | ||
|
|
01a940681e | ||
|
|
bd96cc1d20 | ||
|
|
71f7ed051c | ||
|
|
221f1f30fd | ||
|
|
1696614995 | ||
|
|
8415665bb1 | ||
|
|
0254dc41ca | ||
|
|
a18f981b1c | ||
|
|
cb2a7b5716 | ||
|
|
1f14c1e570 | ||
|
|
7d4e2cce25 | ||
|
|
e48a90a40c | ||
|
|
38ef9742c8 | ||
|
|
7dfb4294e1 | ||
|
|
5be95b85c1 | ||
|
|
2bec392a59 | ||
|
|
dd9cbe2f4b | ||
|
|
6fff2fb122 | ||
|
|
3f7a84b17c | ||
|
|
e59516562f | ||
|
|
9e01f3cd24 | ||
|
|
241cf8c021 | ||
|
|
2ef7f2e252 | ||
|
|
7144eaa00d | ||
|
|
ceb13a9051 | ||
|
|
e958e097aa | ||
|
|
20012885b1 | ||
|
|
b1b4611c55 | ||
|
|
9ae1f40376 | ||
|
|
3dee60fcc0 | ||
|
|
94f881477e | ||
|
|
f4ca597964 | ||
|
|
a5146fc58a | ||
|
|
f031f4bf18 | ||
|
|
ffda07b6bd | ||
|
|
e769d421be | ||
|
|
0daf140b39 | ||
|
|
4225559677 | ||
|
|
69457c873d | ||
|
|
06c099b567 | ||
|
|
ed79352201 | ||
|
|
df4979277a | ||
|
|
becdfc79d2 | ||
|
|
951cb0fef9 | ||
|
|
2b07517e9c | ||
|
|
bb0d9a25b7 | ||
|
|
dc1bff6d19 | ||
|
|
2bb318493a | ||
|
|
b6f341ee04 | ||
|
|
91c2ae6733 | ||
|
|
0fa8c571c8 | ||
|
|
70dae9c208 | ||
|
|
46524aa5f8 | ||
|
|
adab5f1338 | ||
|
|
fafc1a1bfb | ||
|
|
935c5fd62c | ||
|
|
565e6ad509 |
55
.ds.baseline
55
.ds.baseline
@@ -133,8 +133,7 @@
|
||||
"filename": ".github/workflows/checks.yml",
|
||||
"hashed_secret": "5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8",
|
||||
"is_verified": false,
|
||||
"line_number": 68,
|
||||
"is_secret": false
|
||||
"line_number": 68
|
||||
}
|
||||
],
|
||||
"app/assets/js/uswds.min.js": [
|
||||
@@ -399,26 +398,6 @@
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"app/templates/new/components/head.html": [
|
||||
{
|
||||
"type": "Base64 High Entropy String",
|
||||
"filename": "app/templates/new/components/head.html",
|
||||
"hashed_secret": "ee5048791fc7ff45a1545e24f85bec3317371327",
|
||||
"is_verified": false,
|
||||
"line_number": 33,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"app/templates/old/admin_template.html": [
|
||||
{
|
||||
"type": "Base64 High Entropy String",
|
||||
"filename": "app/templates/old/admin_template.html",
|
||||
"hashed_secret": "ee5048791fc7ff45a1545e24f85bec3317371327",
|
||||
"is_verified": false,
|
||||
"line_number": 18,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"deploy-config/sandbox.yml": [
|
||||
{
|
||||
"type": "Secret Keyword",
|
||||
@@ -652,37 +631,7 @@
|
||||
"line_number": 3266,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"tests/notifications_utils/clients/antivirus/test_antivirus_client.py": [
|
||||
{
|
||||
"type": "Secret Keyword",
|
||||
"filename": "tests/notifications_utils/clients/antivirus/test_antivirus_client.py",
|
||||
"hashed_secret": "932b25270abe1301c22c709a19082dff07d469ff",
|
||||
"is_verified": false,
|
||||
"line_number": 16,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"tests/notifications_utils/clients/encryption/test_encryption_client.py": [
|
||||
{
|
||||
"type": "Secret Keyword",
|
||||
"filename": "tests/notifications_utils/clients/encryption/test_encryption_client.py",
|
||||
"hashed_secret": "f1e923a9667de11be6a210849a8651c1bfd81605",
|
||||
"is_verified": false,
|
||||
"line_number": 13,
|
||||
"is_secret": false
|
||||
}
|
||||
],
|
||||
"tests/notifications_utils/clients/zendesk/test_zendesk_client.py": [
|
||||
{
|
||||
"type": "Secret Keyword",
|
||||
"filename": "tests/notifications_utils/clients/zendesk/test_zendesk_client.py",
|
||||
"hashed_secret": "913a73b565c8e2c8ed94497580f619397709b8b6",
|
||||
"is_verified": false,
|
||||
"line_number": 16,
|
||||
"is_secret": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"generated_at": "2025-02-26T18:19:37Z"
|
||||
"generated_at": "2025-05-01T13:44:35Z"
|
||||
}
|
||||
|
||||
3
.github/actions/setup-project/action.yml
vendored
3
.github/actions/setup-project/action.yml
vendored
@@ -16,6 +16,9 @@ runs:
|
||||
- name: Install poetry
|
||||
shell: bash
|
||||
run: pip install poetry==1.8.5
|
||||
- name: Downgrade virtualenv to compatible version
|
||||
shell: bash
|
||||
run: pip install "virtualenv<20.30"
|
||||
- name: Install application dependencies
|
||||
shell: bash
|
||||
run: make bootstrap
|
||||
|
||||
5
.github/workflows/checks.yml
vendored
5
.github/workflows/checks.yml
vendored
@@ -118,6 +118,7 @@ jobs:
|
||||
NOTIFY_E2E_TEST_PASSWORD: ${{ secrets.NOTIFY_E2E_TEST_PASSWORD }}
|
||||
NOTIFY_E2E_TEST_URI: http://localhost:6012/
|
||||
VCAP_SERVICES: ${{ secrets.VCAP_SERVICES }}
|
||||
|
||||
validate-new-relic-config:
|
||||
runs-on: ubuntu-latest
|
||||
environment: staging
|
||||
@@ -165,7 +166,7 @@ jobs:
|
||||
run: make run-flask &
|
||||
env:
|
||||
NOTIFY_ENVIRONMENT: scanning
|
||||
FEATURE_ABOUT_PAGE_ENABLED: true
|
||||
FEATURE_SOCKET_ENABLED: true
|
||||
- name: Run OWASP Baseline Scan
|
||||
uses: zaproxy/action-baseline@v0.14.0
|
||||
with:
|
||||
@@ -177,7 +178,7 @@ jobs:
|
||||
cmd_options: "-I"
|
||||
|
||||
a11y-scan:
|
||||
runs-on: ubuntu-20.04
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/setup-project
|
||||
|
||||
19
.github/workflows/deploy-demo.yml
vendored
19
.github/workflows/deploy-demo.yml
vendored
@@ -24,23 +24,13 @@ jobs:
|
||||
terraform_version: "^1.7.5"
|
||||
terraform_wrapper: false
|
||||
|
||||
- name: Check for changes to Terraform
|
||||
id: changed-terraform-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
terraform/demo/**
|
||||
terraform/shared/**
|
||||
.github/workflows/deploy-demo.yml
|
||||
- name: Terraform init
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/demo
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||
run: terraform init
|
||||
- name: Terraform apply
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/demo
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
@@ -99,16 +89,7 @@ jobs:
|
||||
--var LOGIN_PEM="$LOGIN_PEM"
|
||||
--strategy rolling
|
||||
|
||||
- name: Check for changes to egress config
|
||||
id: changed-egress-config
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
deploy-config/egress_proxy/notify-admin-demo.*.acl
|
||||
.github/actions/deploy-proxy/action.yml
|
||||
.github/workflows/deploy-demo.yml
|
||||
- name: Deploy egress proxy
|
||||
if: steps.changed-egress-config.outputs.any_changed == 'true'
|
||||
uses: ./.github/actions/deploy-proxy
|
||||
env:
|
||||
CF_USERNAME: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||
|
||||
19
.github/workflows/deploy-prod.yml
vendored
19
.github/workflows/deploy-prod.yml
vendored
@@ -24,23 +24,13 @@ jobs:
|
||||
terraform_version: "^1.7.5"
|
||||
terraform_wrapper: false
|
||||
|
||||
- name: Check for changes to Terraform
|
||||
id: changed-terraform-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
terraform/production/**
|
||||
terraform/shared/**
|
||||
.github/workflows/deploy-prod.yml
|
||||
- name: Terraform init
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/production
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||
run: terraform init
|
||||
- name: Terraform apply
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/production
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
@@ -99,16 +89,7 @@ jobs:
|
||||
--var LOGIN_PEM="$LOGIN_PEM"
|
||||
--strategy rolling
|
||||
|
||||
- name: Check for changes to egress config
|
||||
id: changed-egress-config
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
deploy-config/egress_proxy/notify-admin-production.*.acl
|
||||
.github/actions/deploy-proxy/action.yml
|
||||
.github/workflows/deploy-prod.yml
|
||||
- name: Deploy egress proxy
|
||||
if: steps.changed-egress-config.outputs.any_changed == 'true'
|
||||
uses: ./.github/actions/deploy-proxy
|
||||
env:
|
||||
CF_USERNAME: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||
|
||||
19
.github/workflows/deploy.yml
vendored
19
.github/workflows/deploy.yml
vendored
@@ -29,23 +29,13 @@ jobs:
|
||||
terraform_version: "^1.7.5"
|
||||
terraform_wrapper: false
|
||||
|
||||
- name: Check for changes to Terraform
|
||||
id: changed-terraform-files
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
terraform/staging/**
|
||||
terraform/shared/**
|
||||
.github/workflows/deploy.yml
|
||||
- name: Terraform init
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/staging
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.TERRAFORM_STATE_SECRET_ACCESS_KEY }}
|
||||
run: terraform init
|
||||
- name: Terraform apply
|
||||
if: steps.changed-terraform-files.outputs.any_changed == 'true'
|
||||
working-directory: terraform/staging
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.TERRAFORM_STATE_ACCESS_KEY }}
|
||||
@@ -106,16 +96,7 @@ jobs:
|
||||
--strategy rolling
|
||||
|
||||
|
||||
- name: Check for changes to egress config
|
||||
id: changed-egress-config
|
||||
uses: tj-actions/changed-files@v45
|
||||
with:
|
||||
files: |
|
||||
deploy-config/egress_proxy/notify-admin-staging.*.acl
|
||||
.github/actions/deploy-proxy/action.yml
|
||||
.github/workflows/deploy.yml
|
||||
- name: Deploy egress proxy
|
||||
if: steps.changed-egress-config.outputs.any_changed == 'true'
|
||||
uses: ./.github/actions/deploy-proxy
|
||||
env:
|
||||
CF_USERNAME: ${{ secrets.CLOUDGOV_USERNAME }}
|
||||
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -14,7 +14,16 @@
|
||||
*.XLSX
|
||||
|
||||
## Non user files allowed to be commited
|
||||
!app/assets/pdf/wa_case_study.pdf
|
||||
!app/assets/pdf/best-practices-for-texting-the-public.pdf
|
||||
!app/assets/pdf/investing-in-notifications-tts-public-benefits-studio-decision-memo.pdf
|
||||
!app/assets/pdf/best-practices-section-outline.pdf
|
||||
!app/assets/pdf/standing-up-your-own-notify.pdf
|
||||
!app/assets/pdf/tcpa_overview.pdf
|
||||
!app/assets/pdf/investing-notifications-tts-public-benefits-memo.pdf
|
||||
!app/assets/pdf/out-of-pilot-announcement.pdf
|
||||
!app/assets/pdf/studio-research-snapshot-2022-07-external.pdf
|
||||
!app/assets/pdf/TCPA-Overview.pdf
|
||||
!tests/test_pdf_files/no_eof_marker.pdf
|
||||
!tests/test_pdf_files/multi_page_pdf.pdf
|
||||
!tests/test_pdf_files/big.pdf
|
||||
|
||||
5
.pa11yci
5
.pa11yci
@@ -1,7 +1,10 @@
|
||||
{
|
||||
"defaults": {
|
||||
"standard": "WCAG2AA",
|
||||
"runners": ["htmlcs"],
|
||||
"runners": ["htmlcs"],
|
||||
"chromeLaunchConfig": {
|
||||
"executablePath": "/usr/bin/google-chrome"
|
||||
},
|
||||
"concurrency": 1,
|
||||
"hideElements": [
|
||||
"nav > ol a",
|
||||
|
||||
@@ -8,6 +8,7 @@ repos:
|
||||
- id: end-of-file-fixer
|
||||
- id: check-yaml
|
||||
- id: check-added-large-files
|
||||
exclude: ^app/assets/pdf/.*\.pdf$
|
||||
- id: debug-statements
|
||||
- id: check-merge-conflict
|
||||
- id: check-toml
|
||||
|
||||
26
Makefile
26
Makefile
@@ -6,6 +6,7 @@ APP_VERSION_FILE = app/version.py
|
||||
|
||||
GIT_BRANCH ?= $(shell git symbolic-ref --short HEAD 2> /dev/null || echo "detached")
|
||||
GIT_COMMIT ?= $(shell git rev-parse HEAD 2> /dev/null || echo "")
|
||||
GIT_HOOKS_PATH ?= $(shell git config --global core.hooksPath || echo "")
|
||||
|
||||
VIRTUALENV_ROOT := $(shell [ -z $$VIRTUAL_ENV ] && echo $$(pwd)/venv || echo $$VIRTUAL_ENV)
|
||||
|
||||
@@ -14,8 +15,8 @@ NVMSH := $(shell [ -f "$(HOME)/.nvm/nvm.sh" ] && echo "$(HOME)/.nvm/nvm.sh" || e
|
||||
## DEVELOPMENT
|
||||
|
||||
.PHONY: bootstrap
|
||||
bootstrap: generate-version-file ## Set up everything to run the app
|
||||
poetry self add poetry-dotenv-plugin
|
||||
bootstrap: ## Set up everything to run the app
|
||||
make generate-version-file
|
||||
poetry lock --no-update
|
||||
poetry install --sync --no-root
|
||||
poetry run playwright install --with-deps
|
||||
@@ -24,6 +25,19 @@ bootstrap: generate-version-file ## Set up everything to run the app
|
||||
source $(NVMSH) && npm ci --no-audit
|
||||
source $(NVMSH) && npm run build
|
||||
|
||||
.PHONY: bootstrap-with-git-hooks
|
||||
bootstrap-with-git-hooks: ## Sets everything up and accounts for pre-existing git hooks
|
||||
make generate-version-file
|
||||
poetry lock --no-update
|
||||
poetry install --sync --no-root
|
||||
poetry run playwright install --with-deps
|
||||
git config --global --unset-all core.hooksPath
|
||||
poetry run pre-commit install
|
||||
git config --global core.hookspath "${GIT_HOOKS_PATH}"
|
||||
source $(NVMSH) --no-use && nvm install && npm install
|
||||
source $(NVMSH) && npm ci --no-audit
|
||||
source $(NVMSH) && npm run build
|
||||
|
||||
.PHONY: watch-frontend
|
||||
watch-frontend: ## Build frontend and watch for changes
|
||||
source $(NVMSH) && npm run watch
|
||||
@@ -53,7 +67,7 @@ generate-version-file: ## Generates the app version file
|
||||
@echo -e "__git_commit__ = \"${GIT_COMMIT}\"\n__time__ = \"${DATE}\"" > ${APP_VERSION_FILE}
|
||||
|
||||
.PHONY: test
|
||||
test: py-lint py-test js-lint js-test ## Run tests
|
||||
test: py-lint py-test js-test ## Run tests
|
||||
|
||||
.PHONY: py-lint
|
||||
py-lint: ## Run python linting scanners and black
|
||||
@@ -83,18 +97,18 @@ too-complex:
|
||||
py-test: export NEW_RELIC_ENVIRONMENT=test
|
||||
py-test: ## Run python unit tests
|
||||
poetry run coverage run -m pytest --maxfail=10 --ignore=tests/end_to_end tests/
|
||||
poetry run coverage report --fail-under=96
|
||||
poetry run coverage report --fail-under=93
|
||||
poetry run coverage html -d .coverage_cache
|
||||
|
||||
.PHONY: dead-code
|
||||
dead-code: ## 60% is our aspirational goal, but currently breaks the build
|
||||
poetry run vulture ./app ./notifications_utils --min-confidence=100
|
||||
|
||||
|
||||
.PHONY: e2e-test
|
||||
e2e-test: export NEW_RELIC_ENVIRONMENT=test
|
||||
e2e-test: ## Run end-to-end integration tests; note that --browser webkit isn't currently working
|
||||
DEBUG=pw:api,pw:browser poetry run pytest -vv --browser chromium --browser firefox tests/end_to_end
|
||||
@echo "Running E2E tests in path: $${TESTPATH:-tests/end_to_end}"
|
||||
@bash -c 'DEBUG=pw:api,pw:browser poetry run pytest -vv --browser chromium --browser firefox "$${TESTPATH:-tests/end_to_end}"'
|
||||
|
||||
.PHONY: js-lint
|
||||
js-lint: ## Run javascript linting scanners
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
import secrets
|
||||
from functools import partial
|
||||
from time import monotonic
|
||||
@@ -108,6 +109,7 @@ from app.notify_client.template_statistics_api_client import template_statistics
|
||||
from app.notify_client.upload_api_client import upload_api_client
|
||||
from app.notify_client.user_api_client import user_api_client
|
||||
from app.url_converters import SimpleDateTypeConverter, TemplateTypeConverter
|
||||
from app.utils.api_health import is_api_down
|
||||
from app.utils.govuk_frontend_jinja.flask_ext import init_govuk_frontend
|
||||
from notifications_utils import logging, request_helper
|
||||
from notifications_utils.formatters import (
|
||||
@@ -139,11 +141,14 @@ navigation = {
|
||||
def _csp(config):
|
||||
asset_domain = config["ASSET_DOMAIN"]
|
||||
logo_domain = config["LOGO_CDN_DOMAIN"]
|
||||
return {
|
||||
api_host_name = config["API_HOST_NAME"]
|
||||
|
||||
csp = {
|
||||
"default-src": ["'self'", asset_domain],
|
||||
"frame-src": [
|
||||
"https://www.youtube.com",
|
||||
"https://www.youtube-nocookie.com",
|
||||
"https://www.googletagmanager.com",
|
||||
],
|
||||
"frame-ancestors": "'none'",
|
||||
"form-action": "'self'",
|
||||
@@ -156,6 +161,7 @@ def _csp(config):
|
||||
"https://www.googletagmanager.com",
|
||||
"https://www.google-analytics.com",
|
||||
"https://dap.digitalgov.gov",
|
||||
"https://cdn.socket.io",
|
||||
],
|
||||
"connect-src": [
|
||||
"'self'",
|
||||
@@ -166,17 +172,39 @@ def _csp(config):
|
||||
"img-src": ["'self'", asset_domain, logo_domain],
|
||||
}
|
||||
|
||||
if api_host_name:
|
||||
csp["connect-src"].append(api_host_name)
|
||||
# this is for web socket
|
||||
if api_host_name.startswith("http://"):
|
||||
ws_url = api_host_name.replace("http://", "ws://")
|
||||
csp["connect-src"].append(ws_url)
|
||||
elif api_host_name.startswith("https://"):
|
||||
ws_url = api_host_name.replace("https://", "wss://")
|
||||
csp["connect-src"].append(ws_url)
|
||||
return csp
|
||||
|
||||
|
||||
def create_app(application):
|
||||
@application.after_request
|
||||
def add_csp_header(response):
|
||||
existing_csp = response.headers.get("Content-Security-Policy", "")
|
||||
response.headers["Content-Security-Policy"] = (
|
||||
existing_csp + "; form-action 'self';"
|
||||
)
|
||||
return response
|
||||
|
||||
@application.context_processor
|
||||
def inject_feature_flags():
|
||||
feature_about_page_enabled = application.config.get(
|
||||
"FEATURE_ABOUT_PAGE_ENABLED", False
|
||||
)
|
||||
# this is where feature flags can be easily added as a dictionary within context
|
||||
feature_socket_enabled = application.config.get("FEATURE_SOCKET_ENABLED", False)
|
||||
return dict(
|
||||
FEATURE_ABOUT_PAGE_ENABLED=feature_about_page_enabled,
|
||||
FEATURE_SOCKET_ENABLED=feature_socket_enabled,
|
||||
)
|
||||
|
||||
@application.context_processor
|
||||
def inject_is_api_down():
|
||||
return {"is_api_down": is_api_down()}
|
||||
|
||||
@application.context_processor
|
||||
def inject_initial_signin_url():
|
||||
ttl = 24 * 60 * 60
|
||||
@@ -616,6 +644,8 @@ def setup_event_handlers():
|
||||
|
||||
|
||||
def add_template_filters(application):
|
||||
application.add_template_filter(slugify)
|
||||
|
||||
for fn in [
|
||||
format_auth_type,
|
||||
format_billions,
|
||||
@@ -673,3 +703,10 @@ def init_jinja(application):
|
||||
]
|
||||
jinja_loader = jinja2.FileSystemLoader(template_folders)
|
||||
application.jinja_loader = jinja_loader
|
||||
|
||||
|
||||
def slugify(text):
|
||||
"""
|
||||
Converts text to lowercase, replaces spaces with hyphens, and removes invalid characters.
|
||||
"""
|
||||
return re.sub(r"[^a-z0-9-]", "", re.sub(r"\s+", "-", text.lower()))
|
||||
|
||||
1
app/assets/images/api-error.svg
Normal file
1
app/assets/images/api-error.svg
Normal file
@@ -0,0 +1 @@
|
||||
<svg id="Capa_1" enable-background="new 0 0 512 512" height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g><g><path d="m468.547 144.82h-63.047v-121.32c0-12.958-10.542-23.5-23.5-23.5h-324c-12.958 0-23.5 10.542-23.5 23.5v84.833c.344 9.931 14.659 9.923 15 0v-33.333h341v69.82h-121.998c-14.312 0-25.954 11.574-25.954 25.8v83.174l-28.866 19.221c-5.511 3.444-5.51 12.168.001 15.611l28.865 19.22v83.174c0 14.226 11.643 25.799 25.954 25.799h121.998v71.68c0 4.687-3.813 8.5-8.5 8.5h-324c-4.687 0-8.5-3.813-8.5-8.5v-20h131.5c7.444 0 13.5-6.056 13.5-13.5v-127.999c0-7.444-6.056-13.5-13.5-13.5h-131.5v-168.021c-.344-9.931-14.659-9.923-15 0v168.021h-3.5c-7.444 0-13.5 6.056-13.5 13.5v128c0 7.444 6.056 13.5 13.5 13.5h3.5v20c0 12.958 10.542 23.5 23.5 23.5h324c12.958 0 23.5-10.542 23.5-23.5v-71.68h11.5c9.931-.344 9.923-14.659 0-15h-148.498c-6.04 0-10.954-4.845-10.954-10.799v-85.173c0-3.779-1.882-7.288-5.031-9.384l-23.492-15.643 23.492-15.644c3.15-2.098 5.031-5.606 5.031-9.384v-85.173c0-5.955 4.914-10.8 10.954-10.8h200.045c6.04 0 10.953 4.845 10.953 10.8v220.401c0 5.955-4.913 10.799-10.953 10.799h-16.436c-9.931.344-9.923 14.659 0 15h16.436c14.311 0 25.953-11.574 25.953-25.799v-220.401c0-14.226-11.643-25.8-25.953-25.8zm-256.047-129.82v9.5c-.353 9.929-14.65 9.922-15 0v-9.5zm-55.333 0v9.5c-.353 9.929-14.65 9.922-15 0v-9.5zm-55.334 0v9.5c-.353 9.929-14.65 9.922-15 0v-9.5zm-52.333 45v-36.5c0-4.687 3.813-8.5 8.5-8.5h13.833v9.5c1.135 29.816 43.876 29.793 45 0v-9.5h10.334v9.5c1.135 29.816 43.876 29.793 45 0v-9.5h10.333v9.5c1.135 29.816 43.876 29.793 45 0v-9.5h154.5c4.687 0 8.5 3.813 8.5 8.5v36.5zm-17 268.5h147v125h-147z"/><path d="m451.356 344.514c2.439-4.507 2.214-9.973-.589-14.264l-69.093-105.771c-5.242-8.361-18.107-8.359-23.35 0l-69.092 105.771c-2.803 4.291-3.028 9.756-.589 14.263s7.139 7.307 12.264 7.307h138.186c5.125 0 9.824-2.799 12.263-7.306zm-148.499-7.694 67.143-102.786 67.143 102.786z"/><path d="m362.5 266.32v31.445c.344 9.931 14.659 9.923 15 0v-31.445c-.344-9.931-14.659-9.923-15 0z"/><path d="m370 310.82c-4.143 0-7.5 3.358-7.5 7.5v2.5c.344 9.931 14.659 9.923 15 0v-2.5c0-4.142-3.357-7.5-7.5-7.5z"/><path d="m91.375 123.094h36.375c9.931-.344 9.923-14.659 0-15h-36.375c-9.931.344-9.923 14.66 0 15z"/><path d="m91.375 149.316h90c9.931-.344 9.923-14.659 0-15h-90c-9.931.344-9.923 14.66 0 15z"/><path d="m91.375 175.539h77.625c9.931-.344 9.923-14.659 0-15h-77.625c-9.931.344-9.923 14.659 0 15z"/><path d="m91.375 225.76h36.375c9.931-.344 9.923-14.659 0-15h-36.375c-9.931.344-9.923 14.66 0 15z"/><path d="m91.375 251.982h90c9.931-.344 9.923-14.659 0-15h-90c-9.931.344-9.923 14.66 0 15z"/><path d="m91.375 278.205h77.625c9.931-.344 9.923-14.659 0-15h-77.625c-9.931.344-9.923 14.659 0 15z"/><path d="m139.354 356.038c-2.93-2.929-7.678-2.929-10.607 0l-22.747 22.747-22.747-22.747c-2.93-2.929-7.678-2.929-10.607 0s-2.929 7.678 0 10.606l22.748 22.748-22.748 22.748c-2.929 2.929-2.929 7.678 0 10.606 2.93 2.929 7.677 2.929 10.607 0l22.747-22.747 22.747 22.747c2.93 2.929 7.677 2.929 10.607 0 2.929-2.929 2.929-7.678 0-10.606l-22.748-22.748 22.748-22.748c2.929-2.928 2.929-7.677 0-10.606z"/></g></g></svg>
|
||||
|
After Width: | Height: | Size: 3.1 KiB |
@@ -220,7 +220,7 @@
|
||||
|
||||
var url = type === 'service'
|
||||
? `/services/${currentServiceId}/daily-stats.json?timezone=${encodeURIComponent(userTimezone)}`
|
||||
: `/services/${currentServiceId}/daily-stats-by-user.json`;
|
||||
: `/services/${currentServiceId}/daily-stats-by-user.json?timezone=${encodeURIComponent(userTimezone)}`;
|
||||
|
||||
|
||||
return fetch(url)
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
(function(Modules) {
|
||||
"use strict";
|
||||
|
||||
Modules.Autofocus = function() {
|
||||
this.start = function(component) {
|
||||
var $component = $(component),
|
||||
forceFocus = $component.data('forceFocus');
|
||||
|
||||
// if the page loads with a scroll position, we can't assume the item to focus onload
|
||||
// is still where users intend to start
|
||||
if (($(window).scrollTop() > 0) && !forceFocus) { return; }
|
||||
|
||||
// See if the component itself is something we want to send focus to
|
||||
var target = $component.filter('input, textarea, select');
|
||||
|
||||
// Otherwise look inside the component to see if there are any elements
|
||||
// we want to send focus to
|
||||
if (target.length === 0) {
|
||||
target = $('input, textarea, select', $component);
|
||||
}
|
||||
|
||||
target.eq(0).trigger('focus');
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
})(window.GOVUK.Modules);
|
||||
@@ -1,29 +0,0 @@
|
||||
(function(Modules) {
|
||||
"use strict";
|
||||
|
||||
let isSixDigitHex = value => value.match(/^#[0-9A-F]{6}$/i);
|
||||
let colourOrWhite = value => isSixDigitHex(value) ? value : '#FFFFFF';
|
||||
|
||||
Modules.ColourPreview = function() {
|
||||
|
||||
this.start = component => {
|
||||
|
||||
this.$input = $(component);
|
||||
|
||||
this.$input.closest('.usa-form-group').append(
|
||||
this.$preview = $('<span class="textbox-colour-preview"></span>')
|
||||
);
|
||||
|
||||
this.$input
|
||||
.on('input', this.update)
|
||||
.trigger('input');
|
||||
|
||||
};
|
||||
|
||||
this.update = () => this.$preview.css(
|
||||
'background', colourOrWhite(this.$input.val())
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
})(window.GOVUK.Modules);
|
||||
@@ -1,34 +1,69 @@
|
||||
function announceUploadStatusFromElement() {
|
||||
const srRegion = document.getElementById('upload-status-live');
|
||||
const success = document.getElementById('upload-success');
|
||||
const error = document.getElementById('upload-error');
|
||||
|
||||
if (!srRegion) return;
|
||||
|
||||
const message = error?.textContent || success?.textContent;
|
||||
|
||||
if (message) {
|
||||
srRegion.textContent = '';
|
||||
setTimeout(() => {
|
||||
srRegion.textContent = message + '\u00A0'; // add a non-breaking space
|
||||
srRegion.focus(); // Optional
|
||||
}, 300);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Exported for use in tests
|
||||
function initUploadStatusAnnouncer() {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
announceUploadStatusFromElement();
|
||||
});
|
||||
}
|
||||
|
||||
(function(Modules) {
|
||||
"use strict";
|
||||
|
||||
Modules.FileUpload = function() {
|
||||
|
||||
this.submit = () => this.$form.trigger('submit');
|
||||
|
||||
this.showCancelButton = () => $('.file-upload-button', this.$form).replaceWith(`
|
||||
<a href="" class='usa-button usa-button--secondary'>Cancel upload</a>
|
||||
`);
|
||||
|
||||
this.start = function(component) {
|
||||
|
||||
this.$form = $(component);
|
||||
|
||||
// The label gets styled like a button and is used to hide the native file upload control. This is so that
|
||||
// users see a button that looks like the others on the site.
|
||||
|
||||
this.$form.find('label.file-upload-button').addClass('usa-button margin-bottom-1').attr( {role: 'button', tabindex: '0'} );
|
||||
|
||||
// Clear the form if the user navigates back to the page
|
||||
$(window).on("pageshow", () => this.$form[0].reset());
|
||||
|
||||
// Need to put the event on the container, not the input for it to work properly
|
||||
this.$form.on(
|
||||
'change', '.file-upload-field',
|
||||
() => this.submit() && this.showCancelButton()
|
||||
);
|
||||
|
||||
this.showCancelButton = () => {
|
||||
$('.file-upload-button', this.$form).replaceWith(`
|
||||
<button class='usa-button uploading-button' aria-disabled="true" tabindex="0">
|
||||
Uploading<span class="dot-anim" aria-hidden="true"></span>
|
||||
</button>
|
||||
`);
|
||||
};
|
||||
|
||||
};
|
||||
this.start = function(component) {
|
||||
this.$form = $(component);
|
||||
|
||||
this.$form.on('click', '[data-module="upload-trigger"]', function () {
|
||||
const inputId = $(this).data('file-input-id');
|
||||
const fileInput = document.getElementById(inputId);
|
||||
if (fileInput) fileInput.click();
|
||||
});
|
||||
|
||||
$(window).on("pageshow", () => this.$form[0].reset());
|
||||
|
||||
this.$form.on('change', '.file-upload-field', () => {
|
||||
this.submit();
|
||||
this.showCancelButton();
|
||||
});
|
||||
};
|
||||
};
|
||||
})(window.GOVUK.Modules);
|
||||
|
||||
if (typeof module !== 'undefined' && module.exports) {
|
||||
module.exports = {
|
||||
announceUploadStatusFromElement,
|
||||
initUploadStatusAnnouncer
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
initUploadStatusAnnouncer();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
this.$scrollableTable
|
||||
.on('scroll', this.toggleShadows)
|
||||
.on('scroll', this.maintainHeight)
|
||||
.on('focus blur', () => this.$component.toggleClass('js-focus-style'));
|
||||
|
||||
if (
|
||||
window.GOVUK.stickAtBottomWhenScrolling &&
|
||||
@@ -37,11 +36,11 @@
|
||||
|
||||
this.insertShims = () => {
|
||||
|
||||
const attributesForFocus = 'role aria-labelledby tabindex';
|
||||
const attributesForFocus = 'role aria-labelledby';
|
||||
let captionId = this.$table.find('caption').text().toLowerCase().replace(/[^A-Za-z]+/g, '');
|
||||
|
||||
this.$table.find('caption').attr('id', captionId);
|
||||
this.$table.wrap(`<div class="fullscreen-scrollable-table" role="region" aria-labelledby="${captionId}" tabindex="0"/>`);
|
||||
this.$table.wrap(`<div class="fullscreen-scrollable-table" role="region" aria-labelledby="${captionId}"/>`);
|
||||
|
||||
this.$component
|
||||
.append(
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
(function(window) {
|
||||
"use strict";
|
||||
|
||||
window.GOVUK.Modules.Homepage = function() {
|
||||
|
||||
this.start = function(component) {
|
||||
|
||||
let $component = $(component);
|
||||
let iterations = 0;
|
||||
let timeout = null;
|
||||
|
||||
$component.on('click', () => {
|
||||
if (++iterations == 5) {
|
||||
$component.toggleClass('product-page-intro-wrapper--alternative');
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => iterations = 0, 1500);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
})(window);
|
||||
@@ -1,7 +1,5 @@
|
||||
window.GOVUK.Frontend.initAll();
|
||||
|
||||
$(() => $("time.timeago").timeago());
|
||||
|
||||
var showHideContent = new GOVUK.ShowHideContent();
|
||||
showHideContent.init();
|
||||
|
||||
|
||||
@@ -13,16 +13,23 @@
|
||||
} else {
|
||||
|
||||
$submitButton.data('clicked', 'true');
|
||||
setTimeout(renableSubmitButton($submitButton), 1500);
|
||||
|
||||
if ($submitButton.is('[name="Send"], [name="Schedule"]')) {
|
||||
$submitButton.prop('disabled', true);
|
||||
|
||||
setTimeout(() => {
|
||||
renableSubmitButton($submitButton);
|
||||
}, 10000);
|
||||
} else {
|
||||
setTimeout(renableSubmitButton($submitButton), 1500);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
let renableSubmitButton = $submitButton => () => {
|
||||
|
||||
$submitButton.data('clicked', '');
|
||||
|
||||
$submitButton.prop('disabled', false);
|
||||
};
|
||||
|
||||
$('form').on('submit', disableSubmitButtons);
|
||||
|
||||
75
app/assets/javascripts/socketio.js
Normal file
75
app/assets/javascripts/socketio.js
Normal file
@@ -0,0 +1,75 @@
|
||||
function debounce(func, wait) {
|
||||
let timeout;
|
||||
return function (...args) {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(() => func.apply(this, args), wait);
|
||||
};
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
const isJobPage = window.location.pathname.includes('/jobs/');
|
||||
if (!isJobPage) return;
|
||||
|
||||
const jobEl = document.querySelector('[data-job-id]');
|
||||
const jobId = jobEl?.dataset?.jobId;
|
||||
const featureEnabled = jobEl?.dataset?.feature === 'true';
|
||||
const apiHost = jobEl?.dataset?.host;
|
||||
|
||||
if (!jobId) return;
|
||||
|
||||
if (featureEnabled) {
|
||||
const socket = io(apiHost);
|
||||
|
||||
socket.on('connect', () => {
|
||||
socket.emit('join', { room: `job-${jobId}` });
|
||||
});
|
||||
|
||||
window.addEventListener('beforeunload', () => {
|
||||
socket.emit('leave', { room: `job-${jobId}` });
|
||||
});
|
||||
|
||||
const debouncedUpdate = debounce((data) => {
|
||||
updateAllJobSections();
|
||||
}, 1000);
|
||||
|
||||
socket.on('job_updated', (data) => {
|
||||
if (data.job_id !== jobId) return;
|
||||
debouncedUpdate(data);
|
||||
});
|
||||
}
|
||||
|
||||
function updateAllJobSections() {
|
||||
const resourceEl = document.querySelector('[data-socket-update="status"]');
|
||||
const url = resourceEl?.dataset?.resource;
|
||||
|
||||
if (!url) {
|
||||
console.warn('No resource URL found for job updates');
|
||||
return;
|
||||
}
|
||||
|
||||
fetch(url)
|
||||
.then((res) => res.json())
|
||||
.then(({ status, counts, notifications }) => {
|
||||
const sections = {
|
||||
status: document.querySelector('[data-socket-update="status"]'),
|
||||
counts: document.querySelector('[data-socket-update="counts"]'),
|
||||
notifications: document.querySelector(
|
||||
'[data-socket-update="notifications"]'
|
||||
),
|
||||
};
|
||||
|
||||
if (status && sections.status) {
|
||||
sections.status.innerHTML = status;
|
||||
}
|
||||
if (counts && sections.counts) {
|
||||
sections.counts.innerHTML = counts;
|
||||
}
|
||||
if (notifications && sections.notifications) {
|
||||
sections.notifications.innerHTML = notifications;
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
console.error('Error fetching job update partials:', err);
|
||||
});
|
||||
}
|
||||
});
|
||||
117
app/assets/javascripts/validation.js
Normal file
117
app/assets/javascripts/validation.js
Normal file
@@ -0,0 +1,117 @@
|
||||
function showError(input, errorElement, message) {
|
||||
errorElement.textContent = ""; // Clear existing message
|
||||
errorElement.style.display = "block";
|
||||
|
||||
// Small delay to ensure screen readers pick up the change
|
||||
setTimeout(() => {
|
||||
errorElement.textContent = message;
|
||||
}, 10);
|
||||
|
||||
if (input.type !== "radio" && input.type !== "checkbox") {
|
||||
input.classList.add("usa-input--error");
|
||||
}
|
||||
input.setAttribute("aria-describedby", errorElement.id);
|
||||
}
|
||||
|
||||
function hideError(input, errorElement) {
|
||||
errorElement.style.display = "none";
|
||||
if (input.type !== "radio" && input.type !== "checkbox") {
|
||||
input.classList.remove("usa-input--error");
|
||||
}
|
||||
input.removeAttribute("aria-describedby");
|
||||
}
|
||||
|
||||
function getFieldLabel(input) {
|
||||
const label = document.querySelector(`label[for="${input.id}"]`);
|
||||
return label ? label.textContent.trim() : "This field";
|
||||
}
|
||||
|
||||
// Attach validation logic to forms
|
||||
function attachValidation() {
|
||||
const forms = document.querySelectorAll('form[data-force-focus="True"]');
|
||||
forms.forEach((form) => {
|
||||
const inputs = form.querySelectorAll("input, textarea, select");
|
||||
|
||||
form.addEventListener("submit", function (event) {
|
||||
let isValid = true;
|
||||
let firstInvalidInput = null;
|
||||
const validatedRadioNames = new Set();
|
||||
|
||||
inputs.forEach((input) => {
|
||||
if (input.type === "hidden") return;
|
||||
const errorId = input.type === "radio" ? `${input.name}-error` : `${input.id}-error`;
|
||||
let errorElement = document.getElementById(errorId);
|
||||
|
||||
if (!errorElement) {
|
||||
errorElement = document.createElement("span");
|
||||
errorElement.id = errorId;
|
||||
errorElement.classList.add("usa-error-message");
|
||||
errorElement.setAttribute("aria-live", "polite");
|
||||
errorElement.style.display = "none";
|
||||
if (input.type === "radio") {
|
||||
const group = form.querySelectorAll(`input[name="${input.name}"]`);
|
||||
const lastRadio = group[group.length - 1];
|
||||
lastRadio.parentElement.insertAdjacentElement("afterend", errorElement);
|
||||
} else {
|
||||
input.insertAdjacentElement("afterend", errorElement);
|
||||
}
|
||||
}
|
||||
|
||||
if (input.type === "radio") {
|
||||
if (validatedRadioNames.has(input.name)) return;
|
||||
validatedRadioNames.add(input.name);
|
||||
const radioGroup = form.querySelectorAll(`input[name="${input.name}"]`);
|
||||
const isChecked = Array.from(radioGroup).some(radio => radio.checked);
|
||||
|
||||
if (!isChecked) {
|
||||
showError(input, errorElement, `Error: A selection must be made.`);
|
||||
isValid = false;
|
||||
if (!firstInvalidInput) {
|
||||
firstInvalidInput = input;
|
||||
}
|
||||
}
|
||||
} else if (input.value.trim() === "") {
|
||||
showError(input, errorElement, `Error: ${getFieldLabel(input)} is required.`);
|
||||
isValid = false;
|
||||
if (!firstInvalidInput) {
|
||||
firstInvalidInput = input;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (!isValid) {
|
||||
event.preventDefault();
|
||||
if (firstInvalidInput) firstInvalidInput.focus();
|
||||
}
|
||||
});
|
||||
|
||||
inputs.forEach((input) => {
|
||||
if (input.type === "hidden") return;
|
||||
input.addEventListener("input", function () {
|
||||
const errorId = input.type === "radio" ? `${input.name}-error` : `${input.id}-error`;
|
||||
const errorElement = document.getElementById(errorId);
|
||||
if (errorElement && input.value.trim() !== "") {
|
||||
hideError(input, errorElement);
|
||||
}
|
||||
});
|
||||
if (input.type === "radio") {
|
||||
input.addEventListener("change", function () {
|
||||
const errorElement = document.getElementById(`${input.name}-error`);
|
||||
if (errorElement) {
|
||||
hideError(input, errorElement);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// Automatically attach validation only in the browser
|
||||
if (typeof window !== "undefined") {
|
||||
document.addEventListener("DOMContentLoaded", attachValidation);
|
||||
}
|
||||
|
||||
// ✅ Check if we're in a Node.js environment (for Jest) before using `module.exports`
|
||||
if (typeof module !== "undefined" && typeof module.exports !== "undefined") {
|
||||
module.exports = { showError, hideError, getFieldLabel, attachValidation };
|
||||
}
|
||||
BIN
app/assets/pdf/TCPA-Overview.pdf
Normal file
BIN
app/assets/pdf/TCPA-Overview.pdf
Normal file
Binary file not shown.
BIN
app/assets/pdf/best-practices-for-texting-the-public.pdf
Normal file
BIN
app/assets/pdf/best-practices-for-texting-the-public.pdf
Normal file
Binary file not shown.
BIN
app/assets/pdf/best-practices-section-outline.pdf
Normal file
BIN
app/assets/pdf/best-practices-section-outline.pdf
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
app/assets/pdf/out-of-pilot-announcement.pdf
Normal file
BIN
app/assets/pdf/out-of-pilot-announcement.pdf
Normal file
Binary file not shown.
BIN
app/assets/pdf/standing-up-your-own-notify.pdf
Normal file
BIN
app/assets/pdf/standing-up-your-own-notify.pdf
Normal file
Binary file not shown.
BIN
app/assets/pdf/studio-research-snapshot-2022-07-external.pdf
Normal file
BIN
app/assets/pdf/studio-research-snapshot-2022-07-external.pdf
Normal file
Binary file not shown.
BIN
app/assets/pdf/wa_case_study.pdf
Normal file
BIN
app/assets/pdf/wa_case_study.pdf
Normal file
Binary file not shown.
@@ -60,17 +60,6 @@ $failed: color('gray-cool-20');
|
||||
}
|
||||
}
|
||||
|
||||
.usa-tooltip {
|
||||
line-height: 1;
|
||||
.usa-tooltip__body {
|
||||
width: units(mobile);
|
||||
font-size: size("body", 2);
|
||||
height: auto;
|
||||
white-space: wrap;
|
||||
line-height: units(1);
|
||||
}
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
width: 300px;
|
||||
height: 20px;
|
||||
|
||||
@@ -49,12 +49,12 @@
|
||||
}
|
||||
|
||||
.sms-message-sender, .sms-message-file-name, .sms-message-scheduler, .sms-message-template, .sms-message-sender {
|
||||
margin:0.25rem 0 0;
|
||||
margin: units(0.5) 0 0;
|
||||
}
|
||||
|
||||
.sms-message-recipient {
|
||||
color: color('gray-cool-90');
|
||||
margin: units(1) 0 units(1);
|
||||
margin: units(0.5) 0 units(2);
|
||||
}
|
||||
|
||||
.sms-message-status {
|
||||
@@ -344,3 +344,22 @@ h2.recipient-list {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.usa-search__input, [type=search] {
|
||||
border-right: 1px solid;
|
||||
height: 40px;
|
||||
margin-top: units(1);
|
||||
}
|
||||
|
||||
// Button ellipses loading
|
||||
.dot-anim::after {
|
||||
content: '.';
|
||||
animation: dotPulse 1.5s steps(3, end) infinite;
|
||||
}
|
||||
|
||||
@keyframes dotPulse {
|
||||
0% { content: ''; }
|
||||
33% { content: '.'; }
|
||||
66% { content: '..'; }
|
||||
100% { content: '...'; }
|
||||
}
|
||||
@@ -139,11 +139,6 @@ td.table-empty-message {
|
||||
font-family: family('sans');
|
||||
}
|
||||
|
||||
.usa-dark-background .pill-item__label {
|
||||
color: white;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
|
||||
.pill-item.usa-link {
|
||||
text-decoration: none !important;
|
||||
}
|
||||
@@ -198,9 +193,6 @@ td.table-empty-message {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
// border: 1px solid color('gray-cool-10');
|
||||
// padding: units(2);
|
||||
|
||||
.tick-cross-list-permissions {
|
||||
margin: units(1) 0;
|
||||
padding-left: units(2);
|
||||
@@ -257,6 +249,11 @@ td.table-empty-message {
|
||||
}
|
||||
}
|
||||
|
||||
.usa-checkbox.template-list-item.template-list-item-with-checkbox.template-list-item-without-ancestors {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.usa-checkbox__label-description {
|
||||
margin: units(2px) 0 units(1) units(4);
|
||||
}
|
||||
@@ -288,9 +285,11 @@ td.table-empty-message {
|
||||
@include u-width('mobile-lg');
|
||||
margin-top: units(2);
|
||||
}
|
||||
input#search {
|
||||
input#search-by-name {
|
||||
margin-top: units(1);
|
||||
width: 100%;
|
||||
border: 1px solid color('gray-60');
|
||||
height: 40px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -552,6 +551,24 @@ td.table-empty-message {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.usa-tooltip {
|
||||
&__information {
|
||||
background: color('ink');
|
||||
margin-top: 4px;
|
||||
color: white;
|
||||
border-radius: 50%;
|
||||
height: units(3);
|
||||
width: units(3);
|
||||
border: 1px solid color('ink');
|
||||
}
|
||||
.usa-tooltip__body {
|
||||
min-width: units('card-lg');
|
||||
max-width: units('mobile');
|
||||
white-space: normal;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
|
||||
// Tabs
|
||||
|
||||
.tabs {
|
||||
@@ -575,19 +592,31 @@ td.table-empty-message {
|
||||
.big-number-smallest {
|
||||
font-size: units(3);
|
||||
}
|
||||
.pill-item__label {
|
||||
color: white;
|
||||
}
|
||||
&:not(.pill-item--selected):hover {
|
||||
background: color('blue-warm-70v');
|
||||
|
||||
.pill-item__label {
|
||||
color: white;
|
||||
}
|
||||
}
|
||||
&.pill-item--selected:hover {
|
||||
color: color('blue-60v');
|
||||
&.pill-item--selected {
|
||||
.pill-item__label {
|
||||
color: color('blue-60v');
|
||||
}
|
||||
&:hover {
|
||||
.pill-item__label {
|
||||
color: color('blue-60v');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Etc
|
||||
|
||||
.email-brand,
|
||||
.browse-list {
|
||||
padding: 0;
|
||||
@@ -1028,3 +1057,7 @@ nav.nav {
|
||||
.form-control-error {
|
||||
border: 4px solid #b10e1e
|
||||
}
|
||||
|
||||
.usa-site-alert .usa-alert .usa-alert__body {
|
||||
max-width: 75rem;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
@forward "uswds-theme";
|
||||
@forward "uswds";
|
||||
@forward "uswds-theme-custom-styles";
|
||||
@forward "legacy-styles";
|
||||
@forward "main";
|
||||
@forward "data-visualization";
|
||||
|
||||
@@ -37,6 +37,7 @@ $path: '/static/images/';
|
||||
// Custom overrides
|
||||
.govuk-link {
|
||||
font-weight: bold;
|
||||
color: #005ea5;
|
||||
}
|
||||
|
||||
// Specific to this application
|
||||
|
||||
@@ -88,7 +88,7 @@ class Config(object):
|
||||
],
|
||||
}
|
||||
|
||||
FEATURE_ABOUT_PAGE_ENABLED = getenv("FEATURE_ABOUT_PAGE_ENABLED", "false") == "true"
|
||||
FEATURE_SOCKET_ENABLED = getenv("FEATURE_SOCKET_ENABLED", "false") == "true"
|
||||
|
||||
|
||||
def _s3_credentials_from_env(bucket_prefix):
|
||||
|
||||
@@ -344,7 +344,7 @@ def nl2br(value):
|
||||
html="escape",
|
||||
)
|
||||
).then(utils_nl2br)
|
||||
)
|
||||
) # nosec
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ def govuk_text_input_field_widget(
|
||||
|
||||
return Markup(
|
||||
render_template("components/components/input/template.njk", params=params)
|
||||
)
|
||||
) # nosec
|
||||
|
||||
|
||||
class GovukTextInputField(StringField):
|
||||
@@ -690,7 +690,9 @@ def govuk_checkbox_field_widget(self, field, param_extensions=None, **kwargs):
|
||||
if param_extensions:
|
||||
merge_jsonlike(params, param_extensions)
|
||||
|
||||
return Markup(render_template("forms/fields/checkboxes/macro.njk", params=params))
|
||||
return Markup(
|
||||
render_template("forms/fields/checkboxes/macro.njk", params=params)
|
||||
) # nosec
|
||||
|
||||
|
||||
def govuk_checkboxes_field_widget(
|
||||
@@ -704,7 +706,7 @@ def govuk_checkboxes_field_widget(
|
||||
f' data-field-label="{field_label}">'
|
||||
f" {checkboxes_string}"
|
||||
f"</div>"
|
||||
)
|
||||
) # nosec
|
||||
|
||||
return result
|
||||
|
||||
@@ -757,12 +759,14 @@ def govuk_checkboxes_field_widget(
|
||||
|
||||
return _wrap_in_collapsible(
|
||||
self.field_label,
|
||||
Markup(render_template("forms/fields/checkboxes/macro.njk", params=params)),
|
||||
Markup(
|
||||
render_template("forms/fields/checkboxes/macro.njk", params=params)
|
||||
), # nosec
|
||||
)
|
||||
else:
|
||||
return Markup(
|
||||
render_template("forms/fields/checkboxes/macro.njk", params=params)
|
||||
)
|
||||
) # nosec
|
||||
|
||||
|
||||
def govuk_radios_field_widget(self, field, param_extensions=None, **kwargs):
|
||||
@@ -805,7 +809,7 @@ def govuk_radios_field_widget(self, field, param_extensions=None, **kwargs):
|
||||
|
||||
return Markup(
|
||||
render_template("components/components/radios/template.njk", params=params)
|
||||
)
|
||||
) # nosec
|
||||
|
||||
|
||||
class GovukCheckboxField(BooleanField):
|
||||
|
||||
@@ -61,7 +61,7 @@ class ValidEmail:
|
||||
|
||||
|
||||
class NoCommasInPlaceHolders:
|
||||
def __init__(self, message="You cannot put commas between double brackets"):
|
||||
def __init__(self, message="You cannot put commas between double parenthesis"):
|
||||
self.message = message
|
||||
|
||||
def __call__(self, form, field):
|
||||
@@ -108,33 +108,17 @@ class OnlySMSCharacters:
|
||||
)
|
||||
if non_sms_characters:
|
||||
raise ValidationError(
|
||||
"You cannot use {} in {}. {} will not show up properly on everyone’s phones.".format(
|
||||
"Please remove the unaccepted character {} in your message, then save again".format(
|
||||
formatted_list(
|
||||
non_sms_characters,
|
||||
conjunction="or",
|
||||
conjunction="and",
|
||||
before_each="",
|
||||
after_each="",
|
||||
),
|
||||
{
|
||||
"sms": "text messages",
|
||||
}.get(self._template_type),
|
||||
("It" if len(non_sms_characters) == 1 else "They"),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
# class NoPlaceholders:
|
||||
|
||||
# def __init__(self, message=None):
|
||||
# self.message = message or (
|
||||
# 'You can’t use ((double brackets)) to personalize this message'
|
||||
# )
|
||||
|
||||
# def __call__(self, form, field):
|
||||
# if Field(field.data).placeholders:
|
||||
# raise ValidationError(self.message)
|
||||
|
||||
|
||||
class LettersNumbersSingleQuotesFullStopsAndUnderscoresOnly:
|
||||
regex = re.compile(r"^[a-zA-Z0-9\s\._']+$")
|
||||
|
||||
|
||||
@@ -4,32 +4,22 @@ from functools import partial
|
||||
from itertools import groupby
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from flask import Response, abort, jsonify, render_template, request, session, url_for
|
||||
from flask import abort, jsonify, render_template, request, session, url_for
|
||||
from flask_login import current_user
|
||||
from werkzeug.utils import redirect
|
||||
|
||||
from app import (
|
||||
billing_api_client,
|
||||
current_service,
|
||||
job_api_client,
|
||||
service_api_client,
|
||||
template_statistics_client,
|
||||
)
|
||||
from app.formatters import format_date_numeric, format_datetime_numeric
|
||||
from app.main import main
|
||||
from app.main.views.user_profile import set_timezone
|
||||
from app.statistics_utils import get_formatted_percentage
|
||||
from app.utils import (
|
||||
DELIVERED_STATUSES,
|
||||
FAILURE_STATUSES,
|
||||
REQUESTED_STATUSES,
|
||||
service_has_permission,
|
||||
)
|
||||
from app.utils.csv import Spreadsheet
|
||||
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
||||
from app.utils import DELIVERED_STATUSES, FAILURE_STATUSES, REQUESTED_STATUSES
|
||||
from app.utils.time import get_current_financial_year
|
||||
from app.utils.user import user_has_permissions
|
||||
from notifications_utils.recipients import format_phone_number_human_readable
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/dashboard")
|
||||
@@ -62,28 +52,25 @@ def service_dashboard(service_id):
|
||||
total_messages = service_api_client.get_service_message_ratio(service_id)
|
||||
messages_remaining = total_messages.get("messages_remaining", 0)
|
||||
messages_sent = total_messages.get("messages_sent", 0)
|
||||
all_statistics = template_statistics_client.get_template_statistics_for_service(
|
||||
service_id, limit_days=7
|
||||
)
|
||||
template_statistics = aggregate_template_usage(all_statistics)
|
||||
return render_template(
|
||||
"views/dashboard/dashboard.html",
|
||||
updates_url=url_for(".service_dashboard_updates", service_id=service_id),
|
||||
partials=get_dashboard_partials(service_id),
|
||||
jobs=job_lists,
|
||||
service_data_retention_days=service_data_retention_days,
|
||||
messages_remaining=messages_remaining,
|
||||
messages_sent=messages_sent,
|
||||
template_statistics=template_statistics,
|
||||
most_used_template_count=max(
|
||||
[row["count"] for row in template_statistics] or [0]
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
def job_is_finished(job_dict):
|
||||
done_statuses = [
|
||||
"delivered",
|
||||
"sent",
|
||||
"failed",
|
||||
"technical-failure",
|
||||
"temporary-failure",
|
||||
"permanent-failure",
|
||||
"cancelled",
|
||||
]
|
||||
|
||||
done_statuses = DELIVERED_STATUSES + FAILURE_STATUSES + ["cancelled"]
|
||||
processed_count = sum(
|
||||
stat["count"]
|
||||
for stat in job_dict["statistics"]
|
||||
@@ -120,7 +107,7 @@ def get_local_daily_stats_for_last_x_days(stats_utc, user_timezone, days):
|
||||
]
|
||||
aggregator = {
|
||||
d: {
|
||||
"sms": {"delivered": 0, "failure": 0, "pending": 0, "requested": 0},
|
||||
"sms": {"delivered": 0, "failure": 0, "pending": 0, "requested": 0},
|
||||
"email": {"delivered": 0, "failure": 0, "pending": 0, "requested": 0},
|
||||
}
|
||||
for d in days_list
|
||||
@@ -128,7 +115,9 @@ def get_local_daily_stats_for_last_x_days(stats_utc, user_timezone, days):
|
||||
|
||||
# Convert each UTC timestamp to local date and iterate
|
||||
for utc_ts, data in stats_utc.items():
|
||||
utc_dt = datetime.strptime(utc_ts, "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=ZoneInfo("UTC"))
|
||||
utc_dt = datetime.strptime(utc_ts, "%Y-%m-%dT%H:%M:%SZ").replace(
|
||||
tzinfo=ZoneInfo("UTC")
|
||||
)
|
||||
local_day = utc_dt.astimezone(tz).strftime("%Y-%m-%d")
|
||||
|
||||
if local_day in aggregator:
|
||||
@@ -143,25 +132,18 @@ def get_local_daily_stats_for_last_x_days(stats_utc, user_timezone, days):
|
||||
@user_has_permissions()
|
||||
def get_daily_stats_by_user(service_id):
|
||||
date_range = get_stats_date_range()
|
||||
stats = service_api_client.get_user_service_notification_statistics_by_day(
|
||||
days = date_range["days"]
|
||||
user_timezone = request.args.get("timezone", "UTC")
|
||||
|
||||
stats_utc = service_api_client.get_user_service_notification_statistics_by_day(
|
||||
service_id,
|
||||
user_id=current_user.id,
|
||||
start_date=date_range["start_date"],
|
||||
days=date_range["days"],
|
||||
days=days,
|
||||
)
|
||||
return jsonify(stats)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/dashboard.json")
|
||||
@user_has_permissions("view_activity")
|
||||
def service_dashboard_updates(service_id):
|
||||
return jsonify(**get_dashboard_partials(service_id))
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/template-activity")
|
||||
@user_has_permissions("view_activity")
|
||||
def template_history(service_id):
|
||||
return redirect(url_for("main.template_usage", service_id=service_id), code=301)
|
||||
local_stats = get_local_daily_stats_for_last_x_days(stats_utc, user_timezone, days)
|
||||
return jsonify(local_stats)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/template-usage")
|
||||
@@ -249,103 +231,6 @@ def usage(service_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/monthly")
|
||||
@user_has_permissions("view_activity")
|
||||
def monthly(service_id):
|
||||
year, current_financial_year = requested_and_current_financial_year(request)
|
||||
return render_template(
|
||||
"views/dashboard/monthly.html",
|
||||
months=format_monthly_stats_to_list(
|
||||
service_api_client.get_monthly_notification_stats(service_id, year)["data"]
|
||||
),
|
||||
years=get_tuples_of_financial_years(
|
||||
partial_url=partial(url_for, ".monthly", service_id=service_id),
|
||||
start=current_financial_year - 2,
|
||||
end=current_financial_year,
|
||||
),
|
||||
selected_year=year,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/inbox")
|
||||
@user_has_permissions("view_activity")
|
||||
@service_has_permission("inbound_sms")
|
||||
def inbox(service_id):
|
||||
return render_template(
|
||||
"views/dashboard/inbox.html",
|
||||
partials=get_inbox_partials(service_id),
|
||||
updates_url=url_for(
|
||||
".inbox_updates", service_id=service_id, page=request.args.get("page")
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/inbox.json")
|
||||
@user_has_permissions("view_activity")
|
||||
@service_has_permission("inbound_sms")
|
||||
def inbox_updates(service_id):
|
||||
return jsonify(get_inbox_partials(service_id))
|
||||
|
||||
|
||||
@main.route("/services/<uuid:service_id>/inbox.csv")
|
||||
@user_has_permissions("view_activity")
|
||||
def inbox_download(service_id):
|
||||
return Response(
|
||||
Spreadsheet.from_rows(
|
||||
[
|
||||
[
|
||||
"Phone number",
|
||||
"Message",
|
||||
"Received",
|
||||
]
|
||||
]
|
||||
+ [
|
||||
[
|
||||
format_phone_number_human_readable(message["user_number"]),
|
||||
message["content"].lstrip(("=+-@")),
|
||||
format_datetime_numeric(message["created_at"]),
|
||||
]
|
||||
for message in service_api_client.get_inbound_sms(service_id)["data"]
|
||||
]
|
||||
).as_csv_data,
|
||||
mimetype="text/csv",
|
||||
headers={
|
||||
"Content-Disposition": 'inline; filename="Received text messages {}.csv"'.format(
|
||||
format_date_numeric(datetime.utcnow().isoformat())
|
||||
)
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
def get_inbox_partials(service_id):
|
||||
page = int(request.args.get("page", 1))
|
||||
inbound_messages_data = service_api_client.get_most_recent_inbound_sms(
|
||||
service_id, page=page
|
||||
)
|
||||
inbound_messages = inbound_messages_data["data"]
|
||||
if not inbound_messages:
|
||||
inbound_number = current_service.inbound_number
|
||||
else:
|
||||
inbound_number = None
|
||||
|
||||
prev_page = None
|
||||
if page > 1:
|
||||
prev_page = generate_previous_dict("main.inbox", service_id, page)
|
||||
next_page = None
|
||||
if inbound_messages_data["has_next"]:
|
||||
next_page = generate_next_dict("main.inbox", service_id, page)
|
||||
|
||||
return {
|
||||
"messages": render_template(
|
||||
"views/dashboard/_inbox_messages.html",
|
||||
messages=inbound_messages,
|
||||
inbound_number=inbound_number,
|
||||
prev_page=prev_page,
|
||||
next_page=next_page,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
def filter_out_cancelled_stats(template_statistics):
|
||||
return [s for s in template_statistics if s["status"] != "cancelled"]
|
||||
|
||||
@@ -377,71 +262,6 @@ def aggregate_template_usage(template_statistics, sort_key="count"):
|
||||
return sorted(templates, key=lambda x: x[sort_key], reverse=True)
|
||||
|
||||
|
||||
def aggregate_notifications_stats(template_statistics):
|
||||
template_statistics = filter_out_cancelled_stats(template_statistics)
|
||||
notifications = {
|
||||
template_type: {status: 0 for status in ("requested", "delivered", "failed")}
|
||||
for template_type in ["sms", "email"]
|
||||
}
|
||||
for stat in template_statistics:
|
||||
notifications[stat["template_type"]]["requested"] += stat["count"]
|
||||
if stat["status"] in DELIVERED_STATUSES:
|
||||
notifications[stat["template_type"]]["delivered"] += stat["count"]
|
||||
elif stat["status"] in FAILURE_STATUSES:
|
||||
notifications[stat["template_type"]]["failed"] += stat["count"]
|
||||
|
||||
return notifications
|
||||
|
||||
|
||||
def get_dashboard_partials(service_id):
|
||||
all_statistics = template_statistics_client.get_template_statistics_for_service(
|
||||
service_id, limit_days=7
|
||||
)
|
||||
template_statistics = aggregate_template_usage(all_statistics)
|
||||
stats = aggregate_notifications_stats(all_statistics)
|
||||
|
||||
dashboard_totals = (get_dashboard_totals(stats),)
|
||||
free_sms_allowance = billing_api_client.get_free_sms_fragment_limit_for_year(
|
||||
current_service.id,
|
||||
)
|
||||
# These 2 calls will update the dashboard sms allowance count while in trial mode.
|
||||
billing_api_client.get_monthly_usage_for_service(
|
||||
service_id, get_current_financial_year()
|
||||
)
|
||||
billing_api_client.create_or_update_free_sms_fragment_limit(
|
||||
service_id, free_sms_fragment_limit=free_sms_allowance
|
||||
)
|
||||
|
||||
yearly_usage = billing_api_client.get_annual_usage_for_service(
|
||||
service_id,
|
||||
get_current_financial_year(),
|
||||
)
|
||||
return {
|
||||
"upcoming": render_template(
|
||||
"views/dashboard/_upcoming.html",
|
||||
),
|
||||
"inbox": render_template(
|
||||
"views/dashboard/_inbox.html",
|
||||
),
|
||||
"totals": render_template(
|
||||
"views/dashboard/_totals.html",
|
||||
service_id=service_id,
|
||||
statistics=dashboard_totals[0],
|
||||
),
|
||||
"template-statistics": render_template(
|
||||
"views/dashboard/template-statistics.html",
|
||||
template_statistics=template_statistics,
|
||||
most_used_template_count=max(
|
||||
[row["count"] for row in template_statistics] or [0]
|
||||
),
|
||||
),
|
||||
"usage": render_template(
|
||||
"views/dashboard/_usage.html",
|
||||
**get_annual_usage_breakdown(yearly_usage, free_sms_allowance),
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
def get_dashboard_totals(statistics):
|
||||
|
||||
for msg_type in statistics.values():
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from flask import (
|
||||
abort,
|
||||
current_app,
|
||||
@@ -19,20 +21,23 @@ from app.main.views.sub_navigation_dictionaries import (
|
||||
)
|
||||
from app.utils.user import user_is_logged_in
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
# Hook to check for feature flags
|
||||
@main.before_request
|
||||
def check_feature_flags():
|
||||
if request.path.startswith("/about") and not current_app.config.get(
|
||||
"FEATURE_ABOUT_PAGE_ENABLED", False
|
||||
):
|
||||
abort(404)
|
||||
# Placeholder for future feature flag checks
|
||||
# Example:
|
||||
# if request.path.startswith("/some-feature") and not current_app.config.get("FEATURE_SOME_FEATURE_ENABLED", False):
|
||||
# abort(404)
|
||||
pass
|
||||
|
||||
|
||||
@main.route("/test/feature-flags")
|
||||
def test_feature_flags():
|
||||
return jsonify(
|
||||
{"FEATURE_ABOUT_PAGE_ENABLED": current_app.config["FEATURE_ABOUT_PAGE_ENABLED"]}
|
||||
{"FEATURE_SOCKET_ENABLED": current_app.config["FEATURE_SOCKET_ENABLED"]}
|
||||
)
|
||||
|
||||
|
||||
@@ -258,11 +263,11 @@ def why_text_messaging():
|
||||
)
|
||||
|
||||
|
||||
@main.route("/join-notify")
|
||||
def join_notify():
|
||||
@main.route("/notify-service-ending")
|
||||
@user_is_logged_in
|
||||
def notify_service_ending():
|
||||
return render_template(
|
||||
"views/join-notify.html",
|
||||
navigation_links=about_notify_nav(),
|
||||
"views/notify-service-ending.html",
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ def accept_invite(token):
|
||||
<a href={url_for("main.sign_out")} class="usa-link">Sign out</a>
|
||||
and click the link again to accept this invite.
|
||||
"""
|
||||
)
|
||||
) # nosec
|
||||
|
||||
flash(message=message)
|
||||
|
||||
@@ -98,7 +98,7 @@ def accept_org_invite(token):
|
||||
""".format(
|
||||
current_user.email_address, url_for("main.sign_out")
|
||||
)
|
||||
)
|
||||
) # nosec
|
||||
|
||||
flash(message=message)
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from functools import partial
|
||||
|
||||
from flask import (
|
||||
Response,
|
||||
abort,
|
||||
current_app,
|
||||
jsonify,
|
||||
redirect,
|
||||
render_template,
|
||||
@@ -57,8 +58,12 @@ def view_job(service_id, job_id):
|
||||
|
||||
filter_args = parse_filter_args(request.args)
|
||||
filter_args["status"] = set_status_filters(filter_args)
|
||||
api_host_name = os.environ.get("API_HOST_NAME")
|
||||
|
||||
return render_template(
|
||||
"views/jobs/job.html",
|
||||
api_host_name=api_host_name,
|
||||
FEATURE_SOCKET_ENABLED=current_app.config["FEATURE_SOCKET_ENABLED"],
|
||||
job=job,
|
||||
status=request.args.get("status", ""),
|
||||
updates_url=url_for(
|
||||
@@ -351,7 +356,7 @@ def _get_job_counts(job):
|
||||
Markup(
|
||||
f"""total<span class="usa-sr-only">
|
||||
{"text message" if job_type == "sms" else job_type}s</span>"""
|
||||
),
|
||||
), # nosec
|
||||
"",
|
||||
job.notification_count,
|
||||
],
|
||||
@@ -359,7 +364,7 @@ def _get_job_counts(job):
|
||||
Markup(
|
||||
f"""pending<span class="usa-sr-only">
|
||||
{message_count_noun(job.notifications_sending, job_type)}</span>"""
|
||||
),
|
||||
), # nosec
|
||||
"pending",
|
||||
job.notifications_sending,
|
||||
],
|
||||
@@ -367,7 +372,7 @@ def _get_job_counts(job):
|
||||
Markup(
|
||||
f"""delivered<span class="usa-sr-only">
|
||||
{message_count_noun(job.notifications_delivered, job_type)}</span>"""
|
||||
),
|
||||
), # nosec
|
||||
"delivered",
|
||||
job.notifications_delivered,
|
||||
],
|
||||
@@ -375,7 +380,7 @@ def _get_job_counts(job):
|
||||
Markup(
|
||||
f"""failed<span class="usa-sr-only">
|
||||
{message_count_noun(job.notifications_failed, job_type)}</span>"""
|
||||
),
|
||||
), # nosec
|
||||
"failed",
|
||||
job.notifications_failed,
|
||||
],
|
||||
@@ -465,4 +470,4 @@ def get_preview_of_content(notification):
|
||||
notification["personalisation"],
|
||||
redact_missing_personalisation=True,
|
||||
).subject
|
||||
)
|
||||
) # nosec
|
||||
|
||||
@@ -4,6 +4,7 @@ import uuid
|
||||
from string import ascii_uppercase
|
||||
from zipfile import BadZipFile
|
||||
|
||||
import bleach
|
||||
from flask import (
|
||||
abort,
|
||||
current_app,
|
||||
@@ -167,10 +168,12 @@ def send_messages(service_id, template_id):
|
||||
# just show the first error, as we don't expect the form to have more
|
||||
# than one, since it only has one field
|
||||
first_field_errors = list(form.errors.values())[0]
|
||||
error_message = '<span class="usa-error-message">'
|
||||
error_message = '<span class="error-message usa-error-message">'
|
||||
error_message = f"{error_message}{first_field_errors[0]}"
|
||||
error_message = f"{error_message}</span>"
|
||||
error_message = Markup(error_message)
|
||||
# use 'nosec' because we applied bleach.clean to strip dangerous tags
|
||||
error_message = bleach.clean(error_message)
|
||||
error_message = Markup(error_message) # nosec
|
||||
flash(error_message)
|
||||
column_headings = get_spreadsheet_column_headings_from_template(template)
|
||||
|
||||
@@ -478,6 +481,7 @@ def send_one_off_step(service_id, template_id, step_index):
|
||||
),
|
||||
template=template,
|
||||
form=form,
|
||||
current_placeholder=current_placeholder,
|
||||
skip_link=get_skip_link(step_index, template),
|
||||
back_link=back_link,
|
||||
link_to_upload=(
|
||||
@@ -557,24 +561,47 @@ def _check_messages(service_id, template_id, upload_id, preview_row, **kwargs):
|
||||
)
|
||||
|
||||
if request.args.get("from_test"):
|
||||
# TODO: may not be required after letters code removed
|
||||
back_link = url_for(
|
||||
"main.send_one_off", service_id=service_id, template_id=template.id
|
||||
)
|
||||
back_link_from_preview = url_for(
|
||||
"main.send_one_off", service_id=service_id, template_id=template.id
|
||||
)
|
||||
back_link = {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.send_one_off", service_id=service_id, template_id=template.id
|
||||
),
|
||||
"text": "Back to message personalization"
|
||||
},
|
||||
"html": "Back to message personalization"
|
||||
}
|
||||
back_link_from_preview = {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.send_one_off", service_id=service_id, template_id=template.id
|
||||
),
|
||||
"text": "Back to message personalization"
|
||||
},
|
||||
"html": "Back to message personalization"
|
||||
}
|
||||
choose_time_form = None
|
||||
else:
|
||||
back_link = url_for(
|
||||
"main.send_messages", service_id=service_id, template_id=template.id
|
||||
)
|
||||
back_link_from_preview = url_for(
|
||||
"main.check_messages",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
upload_id=upload_id,
|
||||
)
|
||||
back_link = {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.send_messages", service_id=service_id, template_id=template.id
|
||||
),
|
||||
"text": "Back to upload a file"
|
||||
},
|
||||
"html": "Back to upload a file"
|
||||
}
|
||||
back_link_from_preview = {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.check_messages",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
upload_id=upload_id,
|
||||
),
|
||||
"text": "Back to check messages"
|
||||
},
|
||||
"html": "Back to check messages"
|
||||
}
|
||||
choose_time_form = ChooseTimeForm()
|
||||
|
||||
if preview_row < 2:
|
||||
@@ -752,31 +779,60 @@ def get_back_link(
|
||||
preview=False,
|
||||
):
|
||||
if preview:
|
||||
return url_for(
|
||||
"main.check_notification",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
)
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.check_notification",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
),
|
||||
"text": "Back to select delivery time"
|
||||
},
|
||||
"html": "Back to select delivery time"
|
||||
}
|
||||
|
||||
if step_index == 0:
|
||||
if should_skip_template_page(template._template):
|
||||
return url_for(
|
||||
".choose_template",
|
||||
service_id=service_id,
|
||||
)
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
".choose_template",
|
||||
service_id=service_id,
|
||||
),
|
||||
"text": "Back to all templates"
|
||||
},
|
||||
"html": "Back to all templates"
|
||||
}
|
||||
else:
|
||||
return url_for(
|
||||
".view_template",
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
".view_template",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
),
|
||||
"text": "Back to confirm your template"
|
||||
},
|
||||
"html": "Back to confirm your template"
|
||||
}
|
||||
|
||||
# fallback for other steps
|
||||
back_to_text = (
|
||||
"Back to select recipients" if step_index == 1 else "Back to message personalization"
|
||||
)
|
||||
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.send_one_off_step",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
)
|
||||
|
||||
return url_for(
|
||||
"main.send_one_off_step",
|
||||
service_id=service_id,
|
||||
template_id=template.id,
|
||||
step_index=step_index - 1,
|
||||
)
|
||||
step_index=step_index - 1,
|
||||
),
|
||||
"text": back_to_text
|
||||
},
|
||||
"html": back_to_text
|
||||
}
|
||||
|
||||
|
||||
def get_skip_link(step_index, template):
|
||||
@@ -876,7 +932,7 @@ def _check_notification(service_id, template_id, exception=None, **kwargs):
|
||||
if (not session.get("recipient")) or not all_placeholders_in_session(
|
||||
template.placeholders
|
||||
):
|
||||
raise PermanentRedirect(back_link)
|
||||
raise PermanentRedirect(back_link["href"]["url"])
|
||||
|
||||
template.values = get_recipient_and_placeholders_from_session(
|
||||
template.template_type
|
||||
@@ -924,6 +980,10 @@ def get_template_error_dict(exception):
|
||||
def preview_notification(service_id, template_id):
|
||||
recipient = get_recipient()
|
||||
if not recipient:
|
||||
current_app.logger.warning(
|
||||
f"No recipient found for service {service_id}, template {template_id}. Redirecting..."
|
||||
)
|
||||
|
||||
return redirect(
|
||||
url_for(
|
||||
".send_one_off",
|
||||
|
||||
@@ -62,7 +62,7 @@ def _get_access_token(code): # pragma: no cover
|
||||
code_param = f"code={code}"
|
||||
url = f"{base_url}{cli_assert}&{cli_assert_type}&{code_param}&grant_type=authorization_code"
|
||||
headers = {"Authorization": "Bearer %s" % token}
|
||||
response = requests.post(url, headers=headers)
|
||||
response = requests.post(url, headers=headers, timeout=30)
|
||||
|
||||
response_json = response.json()
|
||||
id_token = get_id_token(response_json)
|
||||
@@ -88,10 +88,7 @@ def _get_access_token(code): # pragma: no cover
|
||||
def _get_user_email_and_uuid(access_token): # pragma: no cover
|
||||
headers = {"Authorization": "Bearer %s" % access_token}
|
||||
user_info_url = os.getenv("LOGIN_DOT_GOV_USER_INFO_URL")
|
||||
user_attributes = requests.get(
|
||||
user_info_url,
|
||||
headers=headers,
|
||||
)
|
||||
user_attributes = requests.get(user_info_url, headers=headers, timeout=30)
|
||||
user_email = user_attributes.json()["email"]
|
||||
user_uuid = user_attributes.json()["sub"]
|
||||
return user_email, user_uuid
|
||||
|
||||
@@ -17,7 +17,7 @@ def _sign_out_at_login_dot_gov():
|
||||
url = f"{base_url}{client_id}&{post_logout_redirect_uri}"
|
||||
current_app.logger.info(f"url={url}")
|
||||
|
||||
response = requests.post(url)
|
||||
response = requests.post(url, timeout=30)
|
||||
|
||||
# response = requests.post(url)
|
||||
current_app.logger.info(f"login.gov response: {response.text}")
|
||||
|
||||
@@ -56,10 +56,6 @@ def about_notify_nav():
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"name": "Join Notify",
|
||||
"link": "main.join_notify",
|
||||
},
|
||||
{
|
||||
"name": "Contact us",
|
||||
"link": "main.contact",
|
||||
|
||||
@@ -680,42 +680,44 @@ def count_content_length(service_id, template_type):
|
||||
)
|
||||
|
||||
|
||||
def _is_latin1(s):
|
||||
return bool(s.encode(encoding="latin-1", errors="strict"))
|
||||
|
||||
|
||||
def _get_content_count_error_and_message_for_template(template):
|
||||
url = "https://en.wikipedia.org/wiki/ISO/IEC_8859-1"
|
||||
if template.template_type == "sms":
|
||||
s1 = f"<html><body>Use of characters outside the <a href='{url}'>IEC_8859-1</a> character set may increase "
|
||||
s2 = "the message fragment count, resulting in additional charges, and these IEC_8859-1 "
|
||||
s3 = "characters may not display properly on some older mobile devices.</body></html>"
|
||||
s1 = (
|
||||
"<html><body>Looks like your template may have one of these characters "
|
||||
"• ™ ∞ ≤ or ≥ or emoji, which won't save."
|
||||
)
|
||||
s2 = "<br>Please remove any unaccepted characters or emojis and try again.</body></html>"
|
||||
|
||||
warning = ""
|
||||
try:
|
||||
_is_latin1(template.content)
|
||||
except UnicodeEncodeError:
|
||||
warning = f"{s1}{s2}{s3}"
|
||||
# Define characters that should be blocked
|
||||
BLOCKED_CHARACTERS = {"•", "™", "∞", "≤", "≥"}
|
||||
|
||||
def contains_blocked_characters(content):
|
||||
"""Check if the content contains explicitly blocked characters."""
|
||||
return any(c in BLOCKED_CHARACTERS for c in content)
|
||||
|
||||
# Check for blocked characters
|
||||
if contains_blocked_characters(template.content):
|
||||
warning = f"{s1}{s2}"
|
||||
return False, Markup(warning) # nosec
|
||||
|
||||
# If message is too long, return the length error
|
||||
if template.is_message_too_long():
|
||||
return True, (
|
||||
f"You have "
|
||||
f"{character_count(template.content_count_without_prefix - SMS_CHAR_COUNT_LIMIT)} "
|
||||
f"too many"
|
||||
)
|
||||
|
||||
# Show charge message as usual if no warning
|
||||
if template.placeholders:
|
||||
return False, (
|
||||
Markup(
|
||||
f"Will be charged as {message_count(template.fragment_count, template.template_type)} "
|
||||
f"(not including personalization). {warning}"
|
||||
)
|
||||
)
|
||||
return False, (
|
||||
# Markup marks html contents safe so that they render properly. Don't use it if there is user input.
|
||||
Markup(
|
||||
f"Will be charged as {message_count(template.fragment_count, template.template_type)}. {warning} "
|
||||
)
|
||||
)
|
||||
return False, Markup(
|
||||
f"Will be charged as {message_count(template.fragment_count, template.template_type)} "
|
||||
f"(not including personalization)."
|
||||
) # nosec
|
||||
|
||||
return False, Markup(
|
||||
f"Will be charged as {message_count(template.fragment_count, template.template_type)}."
|
||||
) # nosec
|
||||
|
||||
|
||||
@main.route(
|
||||
|
||||
@@ -139,14 +139,30 @@ def tour_step(service_id, template_id, step_index):
|
||||
|
||||
def _get_tour_step_back_link(service_id, template_id, step_index):
|
||||
if step_index == 1:
|
||||
return url_for(".begin_tour", service_id=service_id, template_id=template_id)
|
||||
|
||||
return url_for(
|
||||
".tour_step",
|
||||
service_id=service_id,
|
||||
template_id=template_id,
|
||||
step_index=step_index - 1,
|
||||
)
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
'main.begin_tour',
|
||||
service_id=service_id,
|
||||
template_id=template_id
|
||||
),
|
||||
"text": "Back to tour start"
|
||||
},
|
||||
"html": "Back to tour start"
|
||||
}
|
||||
else:
|
||||
return {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.tour_step",
|
||||
service_id=service_id,
|
||||
template_id=template_id,
|
||||
step_index=step_index - 1,
|
||||
),
|
||||
"text": "Back to previous step",
|
||||
},
|
||||
"html": "Back to previous step",
|
||||
}
|
||||
|
||||
|
||||
@main.route(
|
||||
@@ -183,12 +199,18 @@ def check_tour_notification(service_id, template_id):
|
||||
)
|
||||
)
|
||||
|
||||
back_link = url_for(
|
||||
".tour_step",
|
||||
service_id=current_service.id,
|
||||
template_id=template_id,
|
||||
step_index=len(placeholders),
|
||||
)
|
||||
back_link = {
|
||||
"href": {
|
||||
"url": url_for(
|
||||
"main.tour_step",
|
||||
service_id=current_service.id,
|
||||
template_id=template_id,
|
||||
step_index=len(placeholders),
|
||||
),
|
||||
"text": "Back to previous step"
|
||||
},
|
||||
"html": "Back to previous step"
|
||||
}
|
||||
|
||||
template.values = get_recipient_and_placeholders_from_session(
|
||||
template.template_type
|
||||
|
||||
@@ -58,8 +58,6 @@ class HeaderNavigation(Navigation):
|
||||
},
|
||||
"accounts-or-dashboard": {
|
||||
"conversation",
|
||||
"inbox",
|
||||
"monthly",
|
||||
"service_dashboard",
|
||||
"template_usage",
|
||||
"view_notification",
|
||||
@@ -161,8 +159,6 @@ class MainNavigation(Navigation):
|
||||
},
|
||||
"dashboard": {
|
||||
"conversation",
|
||||
"inbox",
|
||||
"monthly",
|
||||
"service_dashboard",
|
||||
"template_usage",
|
||||
"view_notification",
|
||||
|
||||
@@ -116,7 +116,7 @@ class UserApiClient(NotifyAdminAPIClient):
|
||||
data["next"] = next_string
|
||||
if code_type == "email":
|
||||
data["email_auth_link_host"] = self.admin_url
|
||||
endpoint = f"/user/{user_id}/{code_type}-code"
|
||||
endpoint = f"/user/{user_id}/{code_type}-code"
|
||||
current_app.logger.warn(hilite(f"Sending verify_code {code_type} to {user_id}"))
|
||||
self.post(endpoint, data=data)
|
||||
|
||||
|
||||
@@ -28,8 +28,17 @@ def get_csv_upload(service_id, upload_id):
|
||||
return get_s3_object(*get_csv_location(service_id, upload_id))
|
||||
|
||||
|
||||
def remove_blank_lines(filedata):
|
||||
# sometimes people upload files with hundreds of blank lines at the end
|
||||
data = filedata["data"]
|
||||
cleaned_data = "\n".join(line for line in data.splitlines() if line.strip())
|
||||
filedata["data"] = cleaned_data
|
||||
return filedata
|
||||
|
||||
|
||||
def s3upload(service_id, filedata):
|
||||
|
||||
filedata = remove_blank_lines(filedata)
|
||||
upload_id = str(uuid.uuid4())
|
||||
bucket_name, file_location, access_key, secret_key, region = get_csv_location(
|
||||
service_id, upload_id
|
||||
|
||||
@@ -11,10 +11,16 @@
|
||||
{% include "components/head.html" %}
|
||||
</head>
|
||||
<body class="usa-template__body {{ bodyClasses }}">
|
||||
<div id="upload-status-live"
|
||||
class="usa-sr-only"
|
||||
aria-live="assertive"
|
||||
tabindex="-1"
|
||||
role="status">
|
||||
</div>
|
||||
<script nonce="{{ csp_nonce() }}">document.body.className = ((document.body.className) ? document.body.className + ' js-enabled' : 'js-enabled');</script>
|
||||
{% block bodyStart %}
|
||||
{% block extra_javascripts_before_body %}
|
||||
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-WX5NGWF"
|
||||
<noscript><iframe sandbox src="https://www.googletagmanager.com/ns.html?id=GTM-WX5NGWF"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
@@ -29,6 +35,32 @@
|
||||
|
||||
{% block header %}
|
||||
{% include 'components/usa_banner.html' %}
|
||||
{% if not is_api_down %}
|
||||
{% if current_user.is_authenticated or current_service or current_user.platform_admin %}
|
||||
<section class="usa-site-alert usa-site-alert--info" aria-label="Site alert,,,,">
|
||||
<div class="usa-alert">
|
||||
<div class="usa-alert__body">
|
||||
<p class="usa-alert__heading text-bold">Notify.gov Service Ending</p>
|
||||
<p class="usa-alert__text">
|
||||
GSA will no longer offer the Notify.gov service after June 8th, 2025. Visit
|
||||
<a class="usa-link" href="/notify-service-ending">Notify.gov Service Ending</a> for more information.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% else %}
|
||||
<section class="usa-site-alert usa-site-alert--emergency usa-site-alert--no-heading" aria-label="Site alert,,,,">
|
||||
<div class="usa-alert">
|
||||
<div class="usa-alert__body">
|
||||
<p class="usa-alert__heading text-bold">Notify.gov Service Ending</p>
|
||||
<p class="usa-alert__text">
|
||||
Notify.gov is no longer accepting new partners.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% include 'components/header.html' %}
|
||||
{% endblock %}
|
||||
|
||||
@@ -94,10 +126,10 @@
|
||||
{% block footer %}
|
||||
|
||||
{% if current_service and current_service.research_mode %}
|
||||
{% set meta_suffix = 'Built by the <a href="https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/tts-solutions" class="usa-link">Technology Transformation Services</a><span id="research-mode" class="research-mode">research mode</span>' %}
|
||||
{% set meta_suffix = 'Built by the <a href="https://tts.gsa.gov/" class="usa-link">Technology Transformation Services</a><span id="research-mode" class="research-mode">research mode</span>' %}
|
||||
{% else %}
|
||||
{% set commit_hash = ", Latest version: " + config['COMMIT_HASH'] %}
|
||||
{% set long_link = '<a href="https://www.gsa.gov/about-us/organization/federal-acquisition-service/technology-transformation-services/tts-solutions" class="usa-link">Technology Transformation Services</a>' %}
|
||||
{% set long_link = '<a href="https://tts.gsa.gov/" class="usa-link">Technology Transformation Services</a>' %}
|
||||
{% set meta_suffix = "Built by the " + long_link + commit_hash %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -4,10 +4,6 @@
|
||||
{% macro banner(body, type=None, with_tick=False, delete_button=None, subhead=None, context=None, action=None, id=None, thing=None) %}
|
||||
<div
|
||||
class='banner{% if type %}-{{ type }}{% endif %}{% if with_tick %}-with-tick{% endif %}'
|
||||
{% if type == 'dangerous' %}
|
||||
role='group'
|
||||
tabindex='-1'
|
||||
{% endif %}
|
||||
{% if id %}
|
||||
id={{ id }}
|
||||
{% endif %}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{% macro usaBackLink(params) %}
|
||||
{%- include "./template.njk" -%}
|
||||
{%- include "./template.njk" with context %}
|
||||
{% endmacro %}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
<nav class="usa-breadcrumb" aria-label="Breadcrumb">
|
||||
<a href="{{ params.href.url or params.href or '#' }}" class="usa-link usa-back-link display-inline-flex {{ params.classes or '' }}"
|
||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}" {% endfor %}>{{ params.html | safe or params.href.text or 'Back' }}</a>
|
||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}" {% endfor %}>
|
||||
{{- params.html | safe or params.href.text or 'Back' -}}
|
||||
</a>
|
||||
</nav>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
{#- Define common attributes we can use for both button and input types #}
|
||||
|
||||
{%- set buttonAttributes %}{% if params.name %} name="{{ params.name }}"{% endif %} type="{{ params.type if params.type else 'submit' }}"{% if params.disabled %} disabled="disabled" aria-disabled="true"{% endif %}{% if params.preventDoubleClick %} data-prevent-double-click="true"{% endif %}{% endset %}
|
||||
{%- set buttonAttributes %}{% if params.name %} name="{{ params.name | trim }}"{% endif %} type="{{ params.type if params.type else 'submit' }}"{% if params.disabled %} disabled="disabled" aria-disabled="true"{% endif %}{% if params.preventDoubleClick %} data-prevent-double-click="true"{% endif %}{% endset %}
|
||||
|
||||
{#- Actually create a button... or a link! #}
|
||||
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
{% from "../hint/macro.njk" import usaHint %}
|
||||
{% from "../label/macro.njk" import usaLabel %}
|
||||
|
||||
{#- a record of other elements that we need to associate with the input using
|
||||
aria-describedby – for example hints or error messages -#}
|
||||
{# Generate a consistent input ID #}
|
||||
{% set inputId = params.id if params.id else params.label.text | default('unknown') | slugify %}
|
||||
{% set describedBy = params.describedBy if params.describedBy else "" %}
|
||||
|
||||
<div class="usa-form-group {%- if params.errorMessage %} usa-form-group--error{% endif %} {%- if params.formGroup.classes %} {{ params.formGroup.classes }}{% endif %}">
|
||||
{{ usaLabel({
|
||||
html: params.label.html,
|
||||
@@ -12,37 +13,46 @@
|
||||
classes: params.label.classes,
|
||||
isPageHeading: params.label.isPageHeading,
|
||||
attributes: params.label.attributes,
|
||||
for: params.id
|
||||
for: inputId
|
||||
}) | indent(2) | trim }}
|
||||
{% if params.hint %}
|
||||
{% set hintId = params.id + '-hint' %}
|
||||
{% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
|
||||
{{ usaHint({
|
||||
id: hintId,
|
||||
classes: params.hint.classes,
|
||||
attributes: params.hint.attributes,
|
||||
html: params.hint.html,
|
||||
text: params.hint.text
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
{% if params.errorMessage %}
|
||||
{% set errorId = params.id + '-error' %}
|
||||
{% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
|
||||
{{ usaErrorMessage({
|
||||
id: errorId,
|
||||
classes: params.errorMessage.classes,
|
||||
attributes: params.errorMessage.attributes,
|
||||
html: params.errorMessage.html,
|
||||
text: params.errorMessage.text,
|
||||
visuallyHiddenText: params.errorMessage.visuallyHiddenText,
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
<input class="usa-input {%- if params.classes %} {{ params.classes }}{% endif %} {%- if params.errorMessage %} usa-input--error{% endif %}" id="{{ params.id }}" name="{{ params.name }}" type="{{ params.type | default('text') }}"
|
||||
{%- if params.value %} value="{{ params.value}}"{% endif %}
|
||||
{%- if describedBy %} aria-describedby="{{ describedBy }}"{% endif %}
|
||||
{%- if params.autocomplete %} autocomplete="{{ params.autocomplete}}"{% endif %}
|
||||
{%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %}
|
||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}
|
||||
{%- if params.required %} required{% endif %}
|
||||
|
||||
{% if params.hint %}
|
||||
{% set hintId = inputId + '-hint' %}
|
||||
{% set describedBy = describedBy + ' ' + hintId if describedBy else hintId %}
|
||||
{{ usaHint({
|
||||
id: hintId,
|
||||
classes: params.hint.classes,
|
||||
attributes: params.hint.attributes,
|
||||
html: params.hint.html,
|
||||
text: params.hint.text
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
|
||||
{% if params.errorMessage %}
|
||||
{% set errorId = inputId + '-error' %}
|
||||
{% set describedBy = describedBy + ' ' + errorId if describedBy else errorId %}
|
||||
{{ usaErrorMessage({
|
||||
id: errorId,
|
||||
classes: params.errorMessage.classes,
|
||||
attributes: params.errorMessage.attributes,
|
||||
html: params.errorMessage.html,
|
||||
text: params.errorMessage.text,
|
||||
visuallyHiddenText: params.errorMessage.visuallyHiddenText,
|
||||
}) | indent(2) | trim }}
|
||||
{% endif %}
|
||||
|
||||
<input
|
||||
class="usa-input{%- if params.classes %} {{ params.classes }}{% endif %}{%- if params.errorMessage %} usa-input--error{% endif %}"
|
||||
id="{{ inputId }}"
|
||||
name="{{ params.name }}"
|
||||
type="{{ params.type | default('text') }}"
|
||||
{%- if params.value %} value="{{ params.value }}"{% endif %}
|
||||
{%- if describedBy %} aria-describedby="{{ describedBy | trim }}"{% endif %}
|
||||
{# Uncomment below if you want to use aria-labelledby too
|
||||
aria-labelledby="{{ inputId }}-label" #}
|
||||
{%- if params.autocomplete %} autocomplete="{{ params.autocomplete }}"{% endif %}
|
||||
{%- if params.pattern %} pattern="{{ params.pattern }}"{% endif %}
|
||||
{%- for attribute, value in params.attributes %} {{ attribute }}="{{ value }}"{% endfor -%}
|
||||
{%- if params.required %} required{% endif %}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -20,24 +20,28 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if field.errors and show_errors %}
|
||||
<span class="error-message">
|
||||
<span class="error-message usa-error-message">
|
||||
{{ field.errors[0] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</label>
|
||||
{{ field(**{
|
||||
'class': 'file-upload-field',
|
||||
'id': field.name,
|
||||
'accept': allowed_file_extensions|format_list_items('.{item}')|join(',')|e
|
||||
}) }}
|
||||
<label class="file-upload-button" for="{{ field.name }}">
|
||||
{{ button_text }}
|
||||
</label>
|
||||
<button type="button"
|
||||
class="usa-button file-upload-button"
|
||||
data-module="upload-trigger"
|
||||
data-file-input-id="{{ field.name }}">
|
||||
{{ button_text }}
|
||||
</button>
|
||||
{% if alternate_link and alternate_link_text %}
|
||||
<span class="file-upload-alternate-link">
|
||||
or <a class="usa-link" href="{{ alternate_link }}">{{ alternate_link_text }}</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
<label class="file-upload-filename" for="{{ field.name }}"></label>
|
||||
<span class="file-upload-filename" aria-live="polite"></span>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
{{ usaButton({ "text": "Submit", "classes": "file-upload-submit" }) }}
|
||||
</form>
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
class=None,
|
||||
id=None,
|
||||
module=None,
|
||||
data_kwargs={}
|
||||
data_kwargs={},
|
||||
data_force_focus=False
|
||||
) %}
|
||||
<form
|
||||
method="{{ method }}"
|
||||
@@ -19,6 +20,7 @@
|
||||
data-{{ key }}="{{ val }}"
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if data_force_focus %}data-force-focus="{{ data_force_focus }}"{% endif %}
|
||||
novalidate
|
||||
>
|
||||
{{ caller() }}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{% set is_about_page = request.path.startswith('/about') %}
|
||||
{% set is_join_notify_page = request.path.startswith('/join-notify') %}
|
||||
{% set is_contact_page = request.path.startswith('/contact') %}
|
||||
{% set is_information_section = is_about_page or is_join_notify_page or is_contact_page %}
|
||||
{% set is_information_section = is_about_page or is_contact_page %}
|
||||
|
||||
{% if current_user.is_authenticated %}
|
||||
{% set navigation = [
|
||||
@@ -34,7 +33,6 @@
|
||||
{% else %}
|
||||
{% set navigation = [
|
||||
{"href": url_for('main.about_notify'), "text": "About Notify", "active": is_about_page},
|
||||
{"href": url_for('main.join_notify'), "text": "Join Notify", "active": is_join_notify_page},
|
||||
{"href": url_for('main.contact'), "text": "Contact us", "active": is_contact_page}
|
||||
] %}
|
||||
{% endif %}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
show=False,
|
||||
form=None,
|
||||
label=None,
|
||||
autofocus=False
|
||||
autofocus=True
|
||||
) %}
|
||||
{%- set search_label = label or form.search.label.text %}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
} %}
|
||||
|
||||
{% if autofocus %}
|
||||
{% set x=param_extensions.__setitem__("attributes", {"data-module": "autofocus"}) %}
|
||||
{% set _ = param_extensions.__setitem__("attributes", {"autofocus": "autofocus"}) %}
|
||||
{% endif %}
|
||||
|
||||
{% if show %}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<legend class="form-label {% if bold_legend %}bold{% endif %}">
|
||||
{{ field.label.text }}
|
||||
{% if field.errors %}
|
||||
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
||||
<span class="error-message usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
||||
{{ field.errors[0] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
{% if field.errors %}
|
||||
<span class="error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
||||
<span class="error-message usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}">
|
||||
{{ field.errors[0] }}
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
highlight_placeholders=False,
|
||||
autofocus=False,
|
||||
autosize=False,
|
||||
colour_preview=False,
|
||||
help_link=None,
|
||||
help_link_text=None,
|
||||
width='2-3',
|
||||
@@ -13,58 +12,82 @@
|
||||
safe_error_message=False,
|
||||
rows=8,
|
||||
extra_form_group_classes='',
|
||||
placeholder=''
|
||||
placeholder='',
|
||||
input_id=None
|
||||
) %}
|
||||
{% set field_id = kwargs.id if kwargs.id is defined else field.id %}
|
||||
{% set described_by = '' %}
|
||||
{% if hint %}{% set described_by = described_by + field_id ~ '-hint' %}{% endif %}
|
||||
{% if field.errors %}
|
||||
{% if described_by %}{% set described_by = described_by + ' ' %}{% endif %}
|
||||
{% set described_by = described_by + field_id ~ '-error' %}
|
||||
{% endif %}
|
||||
|
||||
<div
|
||||
class="usa-form-group{% if field.errors %} usa-form-group--error{% endif %} {{ extra_form_group_classes }}"
|
||||
data-module="{% if autofocus %}autofocus{% elif colour_preview %}colour-preview{% endif %}"
|
||||
>
|
||||
<label class="usa-label" for="{{ field.name }}">
|
||||
{% if label %}
|
||||
{{ label }}
|
||||
{% else %}
|
||||
{{ field.label.text }}
|
||||
{% endif %}
|
||||
<label class="usa-label" for="{{ field_id }}">
|
||||
{{ label or field.label.text }}
|
||||
</label>
|
||||
|
||||
{% if hint %}
|
||||
<div class="usa-hint">
|
||||
<div class="usa-hint" id="{{ field_id }}-hint">
|
||||
{{ hint }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if field.errors %}
|
||||
<span id="{{ field.name}}-error" class="usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}" tabindex="-1" aria-live="assertive" role="alert">
|
||||
<span id="{{ field_id }}-error" class="error-message usa-error-message" data-module="track-error" data-error-type="{{ field.errors[0] }}" data-error-label="{{ field.name }}" tabindex="-1" aria-live="assertive" role="alert">
|
||||
<span class="usa-sr-only">Error:</span>
|
||||
{% if not safe_error_message %}{{ field.errors[0] }}{% else %}{{ field.errors[0]|safe }}{% endif %}
|
||||
{% if not safe_error_message %}
|
||||
{{ field.errors[0] }}
|
||||
{% else %}
|
||||
{{ field.errors[0] | safe }}
|
||||
{% endif %}
|
||||
</span>
|
||||
{% endif %}
|
||||
{%
|
||||
if highlight_placeholders or autosize
|
||||
%}
|
||||
|
||||
{% if highlight_placeholders or autosize %}
|
||||
{% set field_class = 'usa-textarea form-control-{} textbox-highlight-textbox'.format(width) %}
|
||||
{% else %}
|
||||
{% set field_class = 'form-control-{} {}'.format(width, 'textbox-right-aligned' if suffix else '') %}
|
||||
{% set field_class = 'usa-input' %}
|
||||
{% endif %}
|
||||
{%
|
||||
set field_class = 'form-control ' + field_class + (
|
||||
' form-control-error' if field.errors else ''
|
||||
)
|
||||
%}
|
||||
{{ field(
|
||||
class=field_class,
|
||||
data_module='enhanced-textbox' if highlight_placeholders or autosize else '',
|
||||
data_highlight_placeholders='true' if highlight_placeholders else 'false',
|
||||
rows=rows|string,
|
||||
placeholder=placeholder,
|
||||
aria_describedby=field.name+"-error",
|
||||
required='required' if required else None,
|
||||
**kwargs
|
||||
) }}
|
||||
{% set field_class = 'form-control ' ~ field_class ~ (' form-control-error' if field.errors else '') %}
|
||||
|
||||
{% if autosize or highlight_placeholders %}
|
||||
<textarea
|
||||
id="{{ field_id }}"
|
||||
name="{{ field.name }}"
|
||||
class="{{ field_class }}"
|
||||
rows="{{ rows }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
aria-describedby="{{ described_by.strip() }}"
|
||||
{% if field.flags.required %}required{% endif %}
|
||||
data-module="enhanced-textbox"
|
||||
data-highlight-placeholders="true"
|
||||
>{{ field._value() }}</textarea>
|
||||
{% else %}
|
||||
{% set input_type = 'tel' if 'phone' in field.label.text else 'text' %}
|
||||
<input
|
||||
id="{{ field_id }}"
|
||||
name="{{ field.name }}"
|
||||
type="{{ input_type }}"
|
||||
class="{{ field_class }}"
|
||||
value="{{ field._value() }}"
|
||||
placeholder="{{ placeholder }}"
|
||||
aria-describedby="{{ described_by.strip() }}"
|
||||
{% if field.flags.required %}required{% endif %}
|
||||
/>
|
||||
{% endif %}
|
||||
|
||||
{% if suffix %}
|
||||
<span>{{ suffix }}</span>
|
||||
{% endif %}
|
||||
|
||||
{% if help_link and help_link_text %}
|
||||
<p class="textbox-help-link">
|
||||
<a class="usa-link" href='{{ help_link }}'>{{ help_link_text }}</a>
|
||||
<a class="usa-link" href="{{ help_link }}">{{ help_link_text }}</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
17
app/templates/error/technical_difficulties.html
Normal file
17
app/templates/error/technical_difficulties.html
Normal file
@@ -0,0 +1,17 @@
|
||||
<section class="grid-container usa-section margin-top-5 margin-bottom-5">
|
||||
<div class="grid-row flex-justify-center">
|
||||
<div class="desktop:grid-col-3 tablet:grid-col-4 mobile:grid-col-12 flex-align-center">
|
||||
<img
|
||||
class="width-tablet tablet:width-full"
|
||||
src="{{ asset_url('images/api-error.svg') }}"
|
||||
alt="Mobile phone showing error screen"/>
|
||||
</div>
|
||||
<div class="desktop:grid-col-6 tablet:grid-col-12 padding-left-0 desktop:padding-left-5">
|
||||
<h1 class="font-body-3xl line-height-sans-2 text-bold">
|
||||
There's currently a technical issue.
|
||||
</h1>
|
||||
<p class="font-body-lg line-height-sans-2">Thank you for your patience while we work on it. Notify will be back soon.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -5,10 +5,6 @@
|
||||
</h3>
|
||||
<div id="message-length" class="usa-accordion__content usa-prose">
|
||||
<p class="usa-body">
|
||||
If your message is long then it will
|
||||
cost more.
|
||||
</p>
|
||||
<p class="usa-body">
|
||||
See <a class="usa-link" href="{{ url_for('.pricing') }}">pricing</a> for details.
|
||||
Each message sent to a recipient counts as one text. Keep track on your Dashboard of how many messages have sent and are remaining.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
</h3>
|
||||
<div id="m-a2" class="usa-accordion__content usa-prose">
|
||||
<p class="usa-body">
|
||||
Use double brackets and ‘??’ to define optional content.
|
||||
Use double parenthesis and ‘??’ to define optional content.
|
||||
</p>
|
||||
<p class="bottom-gutter-1-3">
|
||||
For example if you only want to show something to people who are under
|
||||
|
||||
@@ -7,11 +7,10 @@
|
||||
</h3>
|
||||
<div id="personalization" class="usa-accordion__content usa-prose">
|
||||
<p class="bottom-gutter-1-3">
|
||||
Use double brackets to personalize your message:
|
||||
Use double parenthesis to personalize your message:
|
||||
</p>
|
||||
{{ usaInsetText({
|
||||
"text": "Hello ((first name)), your reference is ((ref number))",
|
||||
"classes": ""})
|
||||
}}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
Send a document by email
|
||||
</h2>
|
||||
<p class="usa-body">
|
||||
Use double brackets to add a placeholder field to your template. This will contain a secure link to download the document.
|
||||
Use double parenthesis to add a placeholder field to your template. This will contain a secure link to download the document.
|
||||
</p>
|
||||
{{ usaInsetText({
|
||||
"text": "Download your document at: ((link_to_file))",
|
||||
|
||||
@@ -16,7 +16,10 @@
|
||||
<li>More effectively deliver program outcomes</li>
|
||||
<li>Save administrative costs</li>
|
||||
<li>Implement <a class="use-link usa-link--external"
|
||||
href="https://digital.gov/resources/delivering-digital-first-public-experience/" target="_blank">21st Century
|
||||
href="https://digital.gov/resources/delivering-digital-first-public-experience/"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
aria-label="21st Century IDEA (opens in a new tab)">21st Century
|
||||
IDEA</a> and other directives</li>
|
||||
</ul>
|
||||
<p>Notify.gov is an easy-to-use, web-based platform. It requires no technical expertise or system integration — users
|
||||
@@ -66,7 +69,6 @@
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p><a href="/join-notify">See if Notify is right for you</a></p>
|
||||
<p>Notify.gov is a product of the <a href="/studio">Public Benefits Studio</a>, a product accelerator inside
|
||||
the federal government. </p>
|
||||
</section>
|
||||
|
||||
@@ -22,16 +22,26 @@
|
||||
</ul>
|
||||
<p>
|
||||
Notify.gov operates under a full three-year <a class="use-link usa-link--external"
|
||||
href="https://digital.gov/resources/an-introduction-to-ato/" target="_blank">Authority-to-Operate (ATO)</a>. This
|
||||
href="https://digital.gov/resources/an-introduction-to-ato/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Authority-to-Operate (ATO) (opens in a new tab)">Authority-to-Operate (ATO)</a>. This
|
||||
federal security authorization process leverages security
|
||||
controls provided by National Institute of Standards and Technology (NIST).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Our infrastructure runs on <a class="use-link usa-link--external" href="https://www.cloud.gov/"
|
||||
target="_blank">cloud.gov</a> and utilizes several
|
||||
Our infrastructure runs on <a class="use-link usa-link--external"
|
||||
href="https://www.cloud.gov/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="cloud dot gov (opens in a new tab)">cloud.gov</a> and utilizes several
|
||||
services through Amazon Web
|
||||
Services (AWS), including <a class="use-link usa-link--external" href="https://aws.amazon.com/sns/" target="_blank">
|
||||
Services (AWS), including <a class="use-link usa-link--external"
|
||||
href="https://aws.amazon.com/sns/"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
aria-label="AWS SNS (opens in a new tab)">
|
||||
AWS SNS </a> for sending SMS
|
||||
messages.
|
||||
</p>
|
||||
@@ -53,15 +63,22 @@
|
||||
</p>
|
||||
<h2>Multi-Factor Authentication</h2>
|
||||
<p>
|
||||
Notify.gov uses <a class="use-link usa-link--external" href="https://login.gov/what-is-login/"
|
||||
target="_blank">Login.gov</a> for enhanced security.
|
||||
Notify.gov uses <a class="use-link usa-link--external"
|
||||
href="https://login.gov/what-is-login/"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
aria-label="Login dot gov (opens in a new tab)">Login.gov</a> for enhanced security.
|
||||
Login.gov is an extra layer of security created by the government that uses multi-factor authentication and stronger
|
||||
passwords to protect your account.
|
||||
</p>
|
||||
<p>
|
||||
To access Notify.gov, users will use a Login.gov account associated with their agency (.gov) email with one of the
|
||||
<a class="use-link usa-link--external" href="https://login.gov/help/get-started/authentication-methods/"
|
||||
target="_blank">multi-factor authentication
|
||||
<a class="use-link usa-link--external"
|
||||
href="https://login.gov/help/get-started/authentication-methods/"
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
aria-label="login dot gov multi-factor authentication methods (opens in a new tab)"
|
||||
>multi-factor authentication
|
||||
methods</a> offered through Login.gov.
|
||||
</p>
|
||||
</section>
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
<p>
|
||||
Confusing or <a class="use-link usa-link--external"
|
||||
href="https://kffhealthnews.org/news/tougher-returned-mail-policies-add-to-medicaid-enrollment-drop/"
|
||||
target="_blank">unreceived notifications</a> are one of the largest barriers to people getting and keeping
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="unreceived notifications (opens in a new tab)">unreceived notifications</a> are one of the largest barriers to people getting and keeping
|
||||
benefits. The typical ways the government communicates with people often fall short. Low income households are more
|
||||
likely to experience housing instability, which means paper mail, already slow, can easily be missed.
|
||||
</p>
|
||||
@@ -24,7 +26,9 @@
|
||||
<p>
|
||||
<a class="use-link usa-link--external"
|
||||
href="https://www.pewresearch.org/internet/fact-sheet/mobile/?tabItem=64e32376-5a21-4b1d-8f8b-5f92406db984"
|
||||
target="_blank">Pew Research shows that nearly all adults in the US have a cell phone.</a> Reliance on smartphones
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Pew Research shows that nearly all adults in the US have a cell phone (opens in a new tab)">Pew Research shows that nearly all adults in the US have a cell phone.</a> Reliance on smartphones
|
||||
for online access is especially common among Americans with lower household incomes and those with lower levels of
|
||||
formal education. Of those earning less than $30,000 a year, 28% say their mobile phone is the sole method to
|
||||
digitally connect.
|
||||
@@ -40,8 +44,7 @@
|
||||
</p>
|
||||
<p>
|
||||
Texting not only helps programs reach people using a nearly-universal communication method, it is a cost effective
|
||||
way to do so. With Notify.gov <a href="/join-notify">you can get started for free</a>, allowing you to try out
|
||||
texting to complement your existing communications and outreach strategies.
|
||||
way to do so.
|
||||
</p>
|
||||
<h2 id="what-texting-is-best-for">What texting is best for</h2>
|
||||
<p>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
{{ page_header('About your service') }}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
{% call form_wrapper(data_force_focus=True) %}
|
||||
|
||||
{{ form.name(param_extensions={"hint": {"text": "You can change this later"}}) }}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
{{notification.key_name}}
|
||||
</span>
|
||||
<span class="grid-col-6 api-notifications-item__meta-time">
|
||||
<time class="timeago" datetime="{{ notification.created_at }}">
|
||||
<time datetime="{{ notification.created_at }}">
|
||||
{{ notification.created_at|format_delta }}
|
||||
</time>
|
||||
</span>
|
||||
|
||||
@@ -20,7 +20,11 @@ Error
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
|
||||
|
||||
<div class="">
|
||||
{# Alert for users of AT #}
|
||||
<span id="upload-error" class="usa-sr-only">File upload failed</span>
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
|
||||
{% if recipients.too_many_rows %}
|
||||
@@ -102,7 +106,7 @@ Error
|
||||
<div class="usa-alert usa-alert--error" role="alert">
|
||||
<div class="usa-alert__body">
|
||||
<h1 class="usa-alert__heading banner-title" data-module="track-error" data-error-type="Missing placeholder columns"
|
||||
data-error-label="{{ upload_id }}">Your column names need to match the double brackets in your template</h1>
|
||||
data-error-label="{{ upload_id }}">Your column names need to match the double parenthesis in your template</h1>
|
||||
<p class="usa-alert__text">
|
||||
Your file is missing {{ recipients.missing_column_headers | formatted_list(
|
||||
conjunction='and',
|
||||
@@ -150,7 +154,7 @@ Error
|
||||
) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
<a href="#content" class="usa-link back-to-top-link">Back to top</a>
|
||||
<a href="#content" class="usa-link back-to-top-link display-block margin-top-2">Back to top</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
|
||||
{% block backLink %}
|
||||
{{ usaBackLink({ "href": back_link }) }}
|
||||
{{ usaBackLink(back_link) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
@@ -21,6 +21,8 @@
|
||||
|
||||
{{ template|string }}
|
||||
<div class="bottom-gutter-3-2">
|
||||
{# Alert for users of AT #}
|
||||
<span id="upload-success" class="usa-sr-only">File uploaded successfully</span>
|
||||
<form method="post" enctype="multipart/form-data" action="{{url_for('main.preview_job', service_id=current_service.id, template_id=template_id, upload_id=upload_id)}}" class='page-footer'>
|
||||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" />
|
||||
{% if choose_time_form %}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
|
||||
{% block backLink %}
|
||||
{{ usaBackLink({ "href": back_link_from_preview }) }}
|
||||
{{ usaBackLink(back_link_from_preview) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
@@ -101,6 +101,9 @@
|
||||
{% set button_text %}
|
||||
{{ "Schedule" if scheduled_for else 'Send'}}
|
||||
{% endset %}
|
||||
{{ usaButton({ "text": button_text }) }}
|
||||
{{ usaButton({
|
||||
"text": button_text,
|
||||
"name": button_text
|
||||
}) }}
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
{% block maincolumn_content %}
|
||||
|
||||
<div class="">
|
||||
{# Alert for users of AT #}
|
||||
<span id="upload-failed" class="usa-sr-only">File upload failed</span>
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
{% if row_errors|length == 1 %}
|
||||
<div class="usa-alert usa-alert--error" role="alert">
|
||||
|
||||
@@ -7,19 +7,10 @@
|
||||
{% block content_column_content %}
|
||||
<section class="usa-prose">
|
||||
<h1>{{page_title}}</h1>
|
||||
<p>Is your organization interested in using Notify.gov? Find more information at <a href="/join-notify">Join
|
||||
Notify</a> or contact us at <a href="mailto:tts-notify@gsa.gov"
|
||||
<p>For any questions, contact us at <a href="mailto:tts-notify@gsa.gov"
|
||||
aria-label="contact us at tts-notify@gsa.gov">tts-notify@gsa.gov</a>.</p>
|
||||
<p>You can expect a response within one business day.</p>
|
||||
<div class="usa-summary-box maxw-tablet __web-inspector-hide-shortcut__" role="region"
|
||||
aria-label="For partnership inquiries">
|
||||
<div class="usa-summary-box__body">
|
||||
<div class="usa-summary-box__text">
|
||||
<p class="margin-0">If you are a current Notify.gov partner and have technical issues or questions, we are available at <a
|
||||
href="mailto:notify-support@gsa.gov"
|
||||
aria-label="Email Notify for technical questions at notify-support@gsa.gov">notify-support@gsa.gov</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>If you are a current Notify.gov partner and have technical issues or questions, we are available
|
||||
at <a href="mailto:notify-support@gsa.gov"
|
||||
aria-label="Email Notify for technical questions at notify-support@gsa.gov">notify-support@gsa.gov</a></p>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block backLink %}
|
||||
{{ usaBackLink({ "href": url_for("main.inbox", service_id=current_service.id) }) }}
|
||||
{{ usaBackLink({ "href": url_for("main.service_dashboard", service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<div class="ajax-block">
|
||||
{% if current_service.inbound_sms_summary != None %}
|
||||
<a id="total-received" class="usa-link banner-dashboard" class="banner-dashboard" href="{{ url_for('.inbox', service_id=current_service.id) }}">
|
||||
<span class="banner-dashboard-count">
|
||||
{{ current_service.inbound_sms_summary.count|format_thousands }}
|
||||
</span>
|
||||
<span class="banner-dashboard-count-label">
|
||||
{{ current_service.inbound_sms_summary.count|message_count_label('sms', suffix='received') }}
|
||||
</span>
|
||||
{% if current_service.inbound_sms_summary.most_recent %}
|
||||
<span class="banner-dashboard-meta">
|
||||
latest message {{ current_service.inbound_sms_summary.most_recent | format_delta }}
|
||||
</span>
|
||||
{% endif %}
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -1,38 +0,0 @@
|
||||
{% from "components/table.html" import list_table, field, hidden_field_heading, right_aligned_field_heading, row_heading %}
|
||||
{% from "components/previous-next-navigation.html" import previous_next_navigation %}
|
||||
|
||||
<div class="ajax-block-container">
|
||||
{% if messages %}
|
||||
<p class="bottom-gutter-2-3 top-gutter-1-2">
|
||||
<a href="{{ url_for('.inbox_download', service_id=current_service.id) }}" download class="usa-link bold">Download these messages</a>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% call(item, row_number) list_table(
|
||||
messages,
|
||||
caption="Inbox",
|
||||
caption_visible=False,
|
||||
empty_message='When users text your service’s phone number ({}) you’ll see the messages here'.format(inbound_number),
|
||||
field_headings=[
|
||||
'From',
|
||||
'First two lines of message'
|
||||
],
|
||||
field_headings_visible=False
|
||||
) %}
|
||||
{% call field() %}
|
||||
<a
|
||||
class="usa-link file-list-filename"
|
||||
href="{{ url_for('.conversation', service_id=current_service.id, notification_id=item.id) }}#n{{ item.id }}"
|
||||
>
|
||||
{{ item.user_number | format_phone_number_human_readable }}
|
||||
</a>
|
||||
<span class="file-list-hint">{{ item.content }}</span>
|
||||
{% endcall %}
|
||||
{% call field(align='right') %}
|
||||
<span class="align-with-message-body">
|
||||
{{ item.created_at | format_delta }}
|
||||
</span>
|
||||
{% endcall %}
|
||||
{% endcall %}
|
||||
|
||||
{{ previous_next_navigation(prev_page, next_page) }}
|
||||
</div>
|
||||
@@ -1,25 +0,0 @@
|
||||
<div class="ajax-block-container">
|
||||
<div class="grid-row grid-gap">
|
||||
<div id="total-sms" class="grid-col-12 margin-top-2">
|
||||
<span class="big-number-with-status display-block margin-bottom-2">
|
||||
<p>
|
||||
<span class="big-number-smaller">
|
||||
<span class="big-number-number">
|
||||
{% if statistics['sms']['requested'] is number %}
|
||||
{{ "{:,}".format(statistics['sms']['requested']) }}
|
||||
{% else %}
|
||||
{{ statistics['sms']['requested'] }}
|
||||
{% endif %}
|
||||
</span>
|
||||
<span class="big-number-label">{{ statistics['sms']['requested']|message_count_label('sms', suffix='sent') }} in the last seven days</span>
|
||||
</span>
|
||||
</p>
|
||||
<a class="usa-button usa-button--outline" href="{{ url_for('.view_notifications', service_id=service_id, message_type='sms', status='sending,delivered,failed') }}">
|
||||
Details
|
||||
</a>
|
||||
{# Removing the failures area for now, as the user can click on the above link to see all the details.
|
||||
In the future state of the dashboard, the all statuses will be more apparent with data visualizations #}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,12 +1,12 @@
|
||||
|
||||
|
||||
{% extends "withnav_template.html" %}
|
||||
|
||||
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading, hidden_field_heading, row_heading, notification_status_field, notification_carrier_field, notification_carrier_message_field %}
|
||||
{% from "components/table.html" import list_table, field, text_field, link_field, right_aligned_field_heading,
|
||||
hidden_field_heading, row_heading, notification_status_field, notification_carrier_field,
|
||||
notification_carrier_message_field %}
|
||||
{% from "components/ajax-block.html" import ajax_block %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Dashboard
|
||||
Dashboard
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
@@ -15,29 +15,38 @@
|
||||
|
||||
<div class="dashboard margin-top-0 margin-bottom-2">
|
||||
|
||||
<h1 class="usa-sr-only">Dashboard</h1>
|
||||
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
|
||||
<h1 class="usa-sr-only">Dashboard</h1>
|
||||
{% if current_user.has_permissions('manage_templates') and not current_service.all_templates %}
|
||||
{% include 'views/dashboard/write-first-messages.html' %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'upcoming') }}
|
||||
{% include 'views/dashboard/_upcoming.html' %}
|
||||
|
||||
<h2 class="font-body-2xl line-height-sans-2 margin-top-0">{{ current_service.name }} Dashboard</h2>
|
||||
<h2 class="font-body-2xl line-height-sans-2 margin-top-0">{{ current_service.name }} Dashboard</h2>
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'inbox') }}
|
||||
<div id="totalMessageChartContainer" data-messages-sent="{{ messages_sent }}" data-messages-remaining="{{ messages_remaining }}">
|
||||
<div class="grid-row flex-align-center">
|
||||
<h2 id="chartTitle" class="margin-right-1">Total messages</h2>
|
||||
<button
|
||||
type="button"
|
||||
class="usa-tooltip usa-tooltip__information margin-right-0"
|
||||
data-position="top"
|
||||
title="Total messages track the sum of messages for the service: pending, failed, or delivered"
|
||||
>
|
||||
<span class="usa-sr-only">More information</span>
|
||||
i
|
||||
</button>
|
||||
</div>
|
||||
<svg id="totalMessageChart"></svg>
|
||||
<div id="message"></div>
|
||||
</div>
|
||||
<div id="totalMessageTable" class="margin-0"></div>
|
||||
{% include 'views/dashboard/activity-table.html' %}
|
||||
|
||||
<div id="totalMessageChartContainer" data-messages-sent="{{ messages_sent }}" data-messages-remaining="{{ messages_remaining }}">
|
||||
<h2 id="chartTitle">Total messages</h2>
|
||||
<svg id="totalMessageChart"></svg>
|
||||
<div id="message"></div>
|
||||
</div>
|
||||
<div id="totalMessageTable" class="margin-0"></div>
|
||||
{% if current_user.has_permissions('manage_service') %}{% endif %}
|
||||
|
||||
{% include 'views/dashboard/activity-table.html' %}
|
||||
{% include 'views/dashboard/most-used-templates.html' %}
|
||||
|
||||
{% if current_user.has_permissions('manage_service') %}{% endif %}
|
||||
|
||||
{{ ajax_block(partials, updates_url, 'template-statistics') }}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
{% extends "withnav_template.html" %}
|
||||
{% from "components/ajax-block.html" import ajax_block %}
|
||||
{% from "components/page-header.html" import page_header %}
|
||||
{% from "components/components/back-link/macro.njk" import usaBackLink %}
|
||||
|
||||
{% block service_page_title %}
|
||||
Received text messages
|
||||
{% endblock %}
|
||||
|
||||
|
||||
{% block backLink %}
|
||||
{{ usaBackLink({ "href": url_for('main.service_dashboard', service_id=current_service.id) }) }}
|
||||
{% endblock %}
|
||||
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header('Received text messages') }}
|
||||
|
||||
{{ ajax_block(
|
||||
partials,
|
||||
updates_url,
|
||||
'messages',
|
||||
) }}
|
||||
|
||||
{% endblock %}
|
||||
@@ -34,12 +34,13 @@
|
||||
<td><p>{{ item.template_folder }}</p></td>
|
||||
<td><p>{{ item.last_used|format_datetime_table}}</p></td>
|
||||
<td><p>{{ item.created_by }}</p></td>
|
||||
<td><p>{{ item.count }}</p></td>
|
||||
<td><p>{{ '{:,.0f}'.format(item.count) }}</p></td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<a href="/services/78409625-0c0a-485e-b82c-b19c8f4b1bdb/template-usage" class="usa-link show-more-no-border"><span>See templates by month</span></a>
|
||||
<a
|
||||
href="{{ url_for('.template_usage', service_id=current_service.id) }}" class="usa-link show-more-no-border"><span>See templates by month</span></a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
@@ -11,7 +11,8 @@
|
||||
|
||||
{% block backLink %}
|
||||
{{ usaBackLink({
|
||||
"href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id)
|
||||
"href": url_for('main.choose_template', service_id=current_service.id, template_folder_id=template_folder_id) if template_folder_id else url_for('main.choose_template', service_id=current_service.id),
|
||||
"html": "Back to all templates"
|
||||
}) }}
|
||||
{% endblock %}
|
||||
|
||||
@@ -27,8 +28,8 @@
|
||||
{% set content_hint = 'Your service name will be added to the start of your message. You can turn this off in Settings.' %}
|
||||
{% endif %}
|
||||
|
||||
{% call form_wrapper() %}
|
||||
<div class="grid-row">
|
||||
{% call form_wrapper(data_force_focus=True) %}
|
||||
<div class="grid-container padding-0">
|
||||
<div class="tablet:grid-col-9 mobile-lg:grid-col-12">
|
||||
{{ form.name(param_extensions={
|
||||
"extra_form_group_classes": "margin-bottom-2",
|
||||
@@ -61,12 +62,12 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="grid-row width-full">
|
||||
<div class="grid-row width-mobile-lg">
|
||||
<div class="tablet:grid-col-2 mobile-lg:grid-col-12">
|
||||
{{ page_footer('Save') }}
|
||||
</div>
|
||||
<div class="tablet:grid-col-10 mobile-lg:grid-col-12">
|
||||
<p class="usa-hint margin-top-5 tablet:margin-left-neg-2">
|
||||
<p class="usa-hint margin-top-5 tablet:margin-left-2">
|
||||
After saving, you'll have the option to send.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
<p class="hint">This person has never logged in</p>
|
||||
{% else %}
|
||||
<p>Last logged in
|
||||
<time class="timeago" datetime="{{ user.logged_in_at }}">
|
||||
<time datetime="{{ user.logged_in_at }}">
|
||||
{{ user.logged_in_at|format_delta }}
|
||||
</time>
|
||||
</p>
|
||||
|
||||
@@ -23,7 +23,9 @@
|
||||
<p>
|
||||
When the <a class="use-link usa-link--external"
|
||||
href="https://www.cbpp.org/research/food-assistance/targeted-text-message-outreach-can-increase-wic-enrollment-pilots-show"
|
||||
target="_blank">Center on Budget and Policy Priorities</a> studied WIC, they found key learnings about the
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Center on Budget and Policy Priorities (opens in a new tab)">Center on Budget and Policy Priorities</a> studied WIC, they found key learnings about the
|
||||
quantity of messages delivered, how people engage with messages, and how they take action.
|
||||
</p>
|
||||
|
||||
@@ -68,8 +70,11 @@
|
||||
</li>
|
||||
</ul>
|
||||
<p>
|
||||
The <a class="use-link usa-link--external" href="https://codeforamerica.org/resources/texting-playbook/"
|
||||
target="_blank">Code for America’s Texting
|
||||
The <a class="use-link usa-link--external"
|
||||
href="https://codeforamerica.org/resources/texting-playbook/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Code for America's Texting Playbook (opens in a new tab)">Code for America’s Texting
|
||||
Playbook</a>
|
||||
reported specific learnings around appointment reminders, completing
|
||||
document submission, and maintenance reminders.
|
||||
|
||||
@@ -142,7 +142,9 @@
|
||||
<p>
|
||||
The Department of Veterans Affairs provides a <a class="use-link usa-link--external"
|
||||
href="https://github.com/department-of-veterans-affairs/va.gov-team/blob/master/products/va-notify/notification-guide.md#vanotify-notification-guide"
|
||||
target="_blank">helpful flow-chart</a> that can help you decide if a text message is needed
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="helpful flow-chart (opens in a new tab)">helpful flow-chart</a> that can help you decide if a text message is needed
|
||||
for the communication problem you are trying to solve.
|
||||
</p>
|
||||
<h2>Use a hypothesis framework to plan your campaign</h2>
|
||||
|
||||
@@ -101,8 +101,11 @@
|
||||
<p class="sms-message-wrapper text-left">
|
||||
{{circle_number(7) }}<b>Dept. of Social Services:</b> Hi {{circle_number(8) }}<b>Julie,</b> Your Medicaid
|
||||
renewal is closing December 31, 2023. You can renew online at {{circle_number(9) }}<a
|
||||
class="use-link usa-link--external" href="https://www.application.yourstate.gov" target="_blank"
|
||||
rel="application.yourstate.gov">https://www.application.yourstate.gov</a> or {{circle_number(10) }}
|
||||
class="use-link usa-link--external"
|
||||
href="https://www.application.yourstate.gov"
|
||||
target="_blank"
|
||||
rel="application.yourstate.gov"
|
||||
aria-label="Yourstate dot gov (opens in a new tab)">https://www.application.yourstate.gov</a> or {{circle_number(10) }}
|
||||
<b>call the number on the back</b> of your Medicaid card.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
{% set links = [
|
||||
{
|
||||
"p_text": 'The <a class="use-link usa-link--external" href="https://www.fcc.gov/sites/default/files/tcpa-rules.pdf"
|
||||
target="_blank">Telephone Consumer
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Telephone Consumer Protection Act (TCPA) (opens in a new tab)"
|
||||
>Telephone Consumer
|
||||
Protection Act (TCPA)</a> (47 USC § 227) is the federal law that impacts how organizations are allowed to
|
||||
communicate
|
||||
in bulk with the public via telephone (including text message or SMS).'
|
||||
@@ -37,7 +40,9 @@
|
||||
{
|
||||
"p_text": 'The <a class="use-link usa-link--external"
|
||||
href="https://www.fcc.gov/document/fcc-provides-best-practices-enable-critical-health-care-coverage-calls"
|
||||
target="_blank">FCC has ruled</a> that <b>Federal</b> and <b>State</b> programs are exempt from the TCPA and can
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="FCC has ruled (opens in a new tab)">FCC has ruled</a> that <b>Federal</b> and <b>State</b> programs are exempt from the TCPA and can
|
||||
send
|
||||
text messages to the public without consent if conducting official business. Without explicit mention in the ruling,
|
||||
local governments, phone carriers, or any texting intermediaries might require it.'
|
||||
@@ -52,7 +57,10 @@
|
||||
case.
|
||||
For additional questions about the enforcement of the TCPA, you can watch <a class="use-link usa-link--external"
|
||||
href="https://www.performance.gov/cx/life-experiences/facing-a-financial-shock/outputs/fcc-training/"
|
||||
target="_blank">a recorded training on public
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="a recorded training on public
|
||||
benefits texting (opens in a new tab)">a recorded training on public
|
||||
benefits texting</a> provided by the FCC.'
|
||||
},
|
||||
] %}
|
||||
@@ -65,7 +73,9 @@
|
||||
<h4 class="usa-collection__heading">
|
||||
<a class="usa-link {% if item.is_downloadable %}usa-link--downloadable{% else %}usa-link--external{% endif %}"
|
||||
href="{% if item.is_downloadable %}{{ asset_url(item.url_link) }}{% else %}{{ item.url_link }}{% endif %}"
|
||||
target="_blank">
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="{{ item.url_text }} (opens in a new tab)">
|
||||
{{ item.url_text }}
|
||||
</a>
|
||||
</h4>
|
||||
@@ -119,6 +129,7 @@
|
||||
process
|
||||
to keep your phone number list up-to-date. The FCC offers a <a class="use-link usa-link--external"
|
||||
href="https://www.fcc.gov/reassigned-numbers-database" target="_blank"
|
||||
aria-label="Reassigned Numbers Database (opens in a new tab)"
|
||||
rel="Reassigned Numbers Database">Reassigned
|
||||
Numbers Database</a> to identify phone numbers that may have been reassigned since your agency obtained them.
|
||||
</p>
|
||||
|
||||
@@ -81,7 +81,10 @@
|
||||
</ul>
|
||||
<h2>What provoking action looks like</h2>
|
||||
<p class="padding-bottom-2"><a class="use-link usa-link--external"
|
||||
href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10002044/" target="_blank">Evidence
|
||||
href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC10002044/"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
aria-label="Evidence shows (opens in a new tab)">Evidence
|
||||
shows</a> that employing
|
||||
behavioral science is an effective way to increase the
|
||||
likelihood of a recipient
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<ol class="list list-number">
|
||||
<li>Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.</li>
|
||||
<li>Add a new template or choose an existing template and select <b class="bold">Edit</b>.</li>
|
||||
<li>Add a placeholder using double brackets. For example: Hello ((first name)), your reference is ((ref number)).</li>
|
||||
<li>Add a placeholder using double parenthesis. For example: Hello ((first name)), your reference is ((ref number)).</li>
|
||||
<li>Select <b class="bold">Save</b>.</li>
|
||||
</ol>
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
<ol class="list list-number">
|
||||
<li>Go to the {{ service_link(current_service, 'main.choose_template', 'templates') }} page.</li>
|
||||
<li>Add a new template or choose an existing template and select <b class="bold">Edit</b>.</li>
|
||||
<li>Use double brackets and ?? to define optional content. For example, if you only want to show something to people who are under 18: ((under18??Please get your application signed by a parent or guardian.))</li>
|
||||
<li>Use double parenthesis and ?? to define optional content. For example, if you only want to show something to people who are under 18: ((under18??Please get your application signed by a parent or guardian.))</li>
|
||||
<li>Select <b class="bold">Save</b>.</li>
|
||||
</ol>
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ your recipient to manage their benefits and increase follow-through.</p>
|
||||
|
||||
<h3>To personalize your content</h3>
|
||||
<ol class="list">
|
||||
<li>Add a placeholder to your content by placing two brackets around the personalized elements.</li>
|
||||
<li>Add a placeholder to your content by placing two parenthesis around the personalized elements.</li>
|
||||
<li>You can manually enter the personalized content or you can upload a spreadsheet with the details and let Notify do the
|
||||
work for you.</li>
|
||||
</ol>
|
||||
@@ -78,7 +78,7 @@ all or part of the message contingent upon specific criteria associated with the
|
||||
|
||||
<h3>To add conditional content</h3>
|
||||
<ol class="list">
|
||||
<li>Use two brackets and ?? to define the conditional content.</li>
|
||||
<li>Use two parenthesis and ?? to define the conditional content.</li>
|
||||
<li>You can manually enter the conditional content or you can upload a spreadsheet with the personal details and let Notify
|
||||
do the work for you.</li>
|
||||
</ol>
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
error_message_with_html=True
|
||||
) }}
|
||||
{% endif %}
|
||||
<p>
|
||||
Team members must be invited directly using their .gov email address, not from forwarded invitations. Invitation links to create a Notify.gov account are active for only 24 hours. Expired invitations can e re-sent from the Team members page.
|
||||
</p>
|
||||
|
||||
{% include 'views/manage-users/permissions.html' %}
|
||||
|
||||
|
||||
@@ -11,10 +11,15 @@
|
||||
{% block maincolumn_content %}
|
||||
|
||||
{{ page_header("Message status") }}
|
||||
<div data-job-id="{{ job.id }}" data-feature="{{FEATURE_SOCKET_ENABLED | lower}}" data-host="{{ api_host_name }}">
|
||||
{% if not job.finished_processing %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{ updates_url }}"
|
||||
{% if FEATURE_SOCKET_ENABLED %}
|
||||
data-socket-update="status"
|
||||
{% else %}
|
||||
data-module="update-content"
|
||||
{% endif %}
|
||||
data-key="status"
|
||||
data-form=""
|
||||
>
|
||||
@@ -25,8 +30,12 @@
|
||||
{% endif %}
|
||||
{% if not finished %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{ updates_url }}"
|
||||
{% if FEATURE_SOCKET_ENABLED %}
|
||||
data-socket-update="counts"
|
||||
{% else %}
|
||||
data-module="update-content"
|
||||
{% endif %}
|
||||
data-key="counts"
|
||||
data-form=""
|
||||
>
|
||||
@@ -41,8 +50,12 @@
|
||||
</p>
|
||||
{% if not job.processing_finished %}
|
||||
<div
|
||||
data-module="update-content"
|
||||
data-resource="{{ updates_url }}"
|
||||
{% if FEATURE_SOCKET_ENABLED %}
|
||||
data-socket-update="notifications"
|
||||
{% else %}
|
||||
data-module="update-content"
|
||||
{% endif %}
|
||||
data-key="notifications"
|
||||
data-form=""
|
||||
>
|
||||
@@ -51,7 +64,6 @@
|
||||
{% if not job.processing_finished %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div> </div>
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
</div>
|
||||
|
||||
{% if show_search_box %}
|
||||
<div data-module="autofocus">
|
||||
<div>
|
||||
{{ live_search(target_selector='.user-list-item', show=True, form=form) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="user-list">
|
||||
{% for user in users %}
|
||||
<div class="user-list">
|
||||
{% if user.status != 'cancelled' %}
|
||||
<div class="user-list-item">
|
||||
<h2 class="user-list-item-heading font-body-lg margin-top-0" title="{{ user.email_address }}">
|
||||
@@ -101,7 +101,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user