Commit Graph

613 Commits

Author SHA1 Message Date
Pea Tyczynska
a10304d9c6 Merge pull request #3892 from alphagov/update-remove-webauthn-cred
Let admin user update and delete their security key
2021-05-25 14:33:00 +01:00
Pea Tyczynska
8501aa4ad6 Change name of the form and form field for consistency
Following PR review.

Also update function name for update name of security key in
user api client to be more specific.
2021-05-25 11:55:48 +01:00
Pea Tyczynska
56eac279df Show manage security key page with name change form 2021-05-25 11:40:41 +01:00
Chris Hill-Scott
e2ef8cd36e Show error message if checkbox wasn’t checked
Because we were redirecting in all cases the error message wasn’t being
shown.

This commit changes the endpoint to respond with content (including an
error message) if the `POST` is not successful.
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
7d66dadcd7 Add a confirmation checkbox for live broadcasts
We want people to be really sure before sending a live broadcast, not
just clicking through the green buttons.

This commit adds a checkbox which explains exactly the consequences of
what they’re about to do, tailored to the channel they’re on, and the
area chosen by the person creating the alert.
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
e45bd485e8 Add conditional reveal to network selection
Rather than try to explain all/only just through words we can use some
interaction design to make the hierarchy of choices more explicit.
2021-05-12 16:22:44 +01:00
Chris Hill-Scott
a0f54539cc Add a second step for choosing networks
Only the test channel has the option to isolate messages to one network.

This commits makes the choices less confusing by only showing the
network choice to those who have selected the test channel.
2021-05-12 16:22:44 +01:00
Chris Hill-Scott
f640767f3d Add government channel
We have been asked to support the government channel so that:
- it can be tested
- the option to use it is available for the most severe of emergencies,
  where the public’s choice to opt-out is outweighed by the widespread
  risk to life
2021-05-12 16:22:43 +01:00
Chris Hill-Scott
ffd844b2a7 Add confirmation step to emergency alert settings
It feels quite dangerous that it’s just one click to make an emergency
alerts service live.

This commit adds a confirmation step which explains the consequences of
what you’re about to do.
2021-05-12 14:53:49 +01:00
Katie Smith
f7036825df Stop checking for allowed_broadcast_provider being None
The current_service.allowed_broadcast_provider is now always "all" or
one of the four providers, which means we can simply the code by not
checking if it is None.
2021-05-11 12:20:03 +01:00
Katie Smith
3485475270 Allow provider_restriction to be None or "all"
Until all the data is updated to always be "all", we have to handle the
case of provider_restriction being set to None or "all" (which mean the
same thing).

The code can be tidied up once the broadcast provider_restriction is never None.
2021-05-10 16:18:14 +01:00
Katie Smith
2f9e2dbc9d Send api the broadcast provider restriction of 'all', not 'None'
We're replacing the value of None with the value of all. API has been
updated to accept both values
(1767535def)
so this change starts sending notifications-api the value of "all".
2021-05-10 16:18:14 +01:00
Rebecca Law
5495de0b3b Remove some of the option we have for broadcast services.
This is the first step in making the UI easier for setting the
options for a broadcast service. Here we remove the options for
"Training mode" test channels. When we create a broadcast message for a trail mode service it is marked as stubbed and does not create a broadcast event that is sent to a provider.

The label for the form and setting page have been updated to reflect the
change.
2021-05-05 14:04:51 +01:00
Chris Hill-Scott
c95b2ef8b3 Allow users of the API to search templates by ID
For someone who has retrieved a template ID from their system the only
way to find it in Notify is:
- hack the URL
- click through every template, visually inspecting the ID shown on the
  page until you find the right one

Neither of these is ideal.

This commit adds searching by ID, for those services who have an API
integration. This means we don’t need to confuse teams who aren’t using
the API by talking about IDs.

This is similar to how we let these teams search for notifications by
reference[1]

1. https://github.com/alphagov/notifications-admin/pull/3223/files
2021-04-13 15:24:29 +01:00
David McDonald
3e80ba4734 Fix flake8 and isort errors
Note, isort now has default behaviour of searching recursively so we no
longer need the `-rc` flag
2021-03-08 18:48:56 +00:00
Katie Smith
1f9ea4a72f Stop adding required attribute to WTForm fields
WTForms now renders the `required` attribute if there is a validator
such as `DataRequired`. This was flagged in an accessibility audit as
being unnecessary since it doesn't conform to the Design System
recommendations, which state that "all form fields are considered
mandatory when navigating a government service unless otherwise denoted
by the word ‘(optional)’."

This uses the approach here https://github.com/wtforms/wtforms/pull/361
to overwrite the `render_field` method.
2021-02-24 14:36:21 +00:00
David McDonald
f8f3d44511 Add form to set service broadcast account type
Note, no option at the moment to set the service broadcast account type
as None, or back to without the broadcast permission. This has been done
for speed of development given the chance of us needing this is very
low. We can add it later if we need to.
2021-02-23 16:03:14 +00:00
Pea Tyczynska
36c72bb4cc View edit organisation billing details page 2021-02-16 14:46:13 +00:00
Pea Tyczynska
f0d94a009e Organisation notes visible on organisation settings page 2021-02-16 14:46:11 +00:00
Rebecca Law
f0ce2c6f5b Update utils to version 43.8.
Invalid characters for the first line of a postal address now include < >
2021-02-09 14:07:01 +00:00
Pea Tyczynska
25534dbee3 Remove 'billing' from option labels
They were unnecessary it turned out.
2021-02-03 10:30:02 +00:00
Pea Tyczynska
c60be7000a Add notes to edit billing details page
As per ticket and as per Caley's request, so everything can be
edited together.

Also pluralise labels for billing contact info, to indicate
that putting multiple in is ok, and widen the input fields so
that it is more comfortable to input multiple contact details.
2021-02-03 10:30:02 +00:00
Pea Tyczynska
079f371bc5 Update attribute names following changes in API 2021-02-03 10:30:01 +00:00
Pea Tyczynska
8f21caa87a Change service billing details
View page that lets you change service billing details and
update details on form submission.
2021-02-03 10:30:01 +00:00
Tom Byers
0cedf39992 Merge pull request #3781 from alphagov/add-govuk-radios-7
Add GOVUK radios [part 7]
2021-02-02 11:40:53 +00:00
Tom Byers
0459cbe24f Merge pull request #3768 from alphagov/add-govuk-radios-6
Add GOVUK radios [part 6]
2021-01-27 14:54:30 +00:00
Tom Byers
e013fbb9b3 Merge pull request #3770 from alphagov/fix-extend-params-bug
Fix bug with extend_params function
2021-01-27 10:52:51 +00:00
Tom Byers
513fbff6e0 Convert radios on set-template-sender page
Includes making the legend the h1 for the page to
follow design system guidance:

https://design-system.service.gov.uk/get-started/labels-legends-headings/
2021-01-27 10:52:24 +00:00
Tom Byers
ece956e324 Convert radios on set-sender page
Includes making the legend the page header to
follow design system guidance:

https://design-system.service.gov.uk/get-started/labels-legends-headings/

I had to add some override styles to allow the
legend to classes as a full-width column, and the
radios to be in one that is three-quarters.
2021-01-27 10:52:24 +00:00
Tom Byers
f6cef24617 Convert create API key radios to GOVUK Frontend 2021-01-27 10:52:24 +00:00
Tom Byers
31b344d6b4 Make radioSelect use GOVUK Frontend radios
Includes changing the code so that the radios
aren't split into two columns in the HTML present
when the page loads. This layout is now added by
the JS.
2021-01-26 21:14:48 +00:00
Tom Byers
73afee8a12 Merge pull request #3771 from alphagov/fix-all-radios-forms-with-duplicate-legends
Fix all radios forms with duplicate legends
2021-01-26 10:57:39 +00:00
Tom Byers
1059cf4d81 Remove extend_params in favour of merge_jsonlike
A comment on the pull request for this branch
pointed out that it's not clear why the 'items'
list is deleted and then reassigned in
extend_params:

https://github.com/alphagov/notifications-admin/pull/3770#pullrequestreview-573067465

The simple reason is that we want to use
merge_jsonlike to merge params and
param_extensions (passed in as extensions) but
merge_jsonlike doesn't merge lists correctly.

I realised that if we just make merge_jsonlike
merge lists correctly, we can use it for
everything extend_params does.

This commit does that, and replaces all calls to
extend_params with merge_jsonlike.

Because extend_params is used across many form
field classes, and so many pages, I took the
following precautions after making those changes:
1. found every use of param_extensions
2. looked at the merges onto params that each would
   cause and deduped them to a final list of 6(!)
3. tested pages containing fields from that list
4. added new testcases to the merge_jsonlike tests
   for any merges that exist in our codebase but
   not in our tests
2021-01-22 15:40:28 +00:00
Pea Tyczynska
e2ecff050d Merge pull request #3772 from alphagov/add-service-notes
Add service notes
2021-01-20 17:19:22 +00:00
Tom Byers
863433c127 Stop legend duplication on set-inbound-number 2021-01-20 16:10:37 +00:00
Chris Hill-Scott
066aca4673 Use legend as H1
…seeing as the radios are the only control in the form.

Follows the pattern in
https://github.com/alphagov/notifications-admin/pull/3771/files
2021-01-20 15:43:58 +00:00
Chris Hill-Scott
99b7d8a66f Add flow for composing an alert without a template
We think that in some cases alerts will be composed in the moment, and
therefore making people first create a template is:
- not a good use of their time
- adding some conceptual complexity which they don’t need

This commit makes it possible to type some words and have them go
straight into the `content` field in the database.

In the future we might want to progressively enhance the radio buttons
so they show on the same page (like we do with the grey buttons on the
templates page).
2021-01-18 17:09:01 +00:00
Tom Byers
e06c1f5daa Fix bug with extend_params function
The OrganisationAgreementSignedForm class has a
bug causing it to render different HTML when the
page loads to when you subsequently refresh it.

This commit proposes a change to the extend_params
function to fix it.

extend_params, is used by the
OrganisationAgreementSignedForm, as well as all
the other WTForms field classes we added to wrap
GOVUK Frontend components. Fixing it should
therefore fix any similar bugs with them.

All of these fields send a dict of configuration
data to the GOVUK Frontend component when they
call it, at render time. This dict is 'JSON-like',
meaning it's values can be all the primitives as
well as lists and dicts. This also means it can go
quite deep.

Extending the default configuration

The classes have a default dict of this data kept
privately in the params variable. They let you
change it by passing in an argument called
param_extensions on instantiation, after that,
through an attribute of the same name and at
render time as the same argument (in templates).

The extend_params function

The param_extensions dict is used as a collection
of changes to make to the default params dict.
The changes are applied by the extend_params
function. Its code deletes part of the
param_extensions, a side effect that didn't seem a
problem because it isn't used after the function
has run.

The bug

The bug was only with the part of the HTML that
got its data from the part of the param_extensions
dict that was deleted by extend_params. The class
with the bug set param_extensions when the field
is instantiated, as part of its parent form
definition.

My guess is that param_extensions was stored in
memory, as part of the form class, and reused
when the page refreshed. At that point,
extend_params had deleted part of its data,
causing the bug.
2021-01-15 09:59:32 +00:00
Pea Tyczynska
5818942908 'Change' link links to edit_service_notes 2021-01-14 18:00:44 +00:00
Chris Hill-Scott
7a95e1618e Extract formatters into their own module
We have lots of functions for converting various types of data into
strings to be displayed to the user somewhere.

This commit collects all these functions into their own module, rather
than having them cluttering up `app/__init__.py` or buried amongst
various other things that have ended up in `app/utils.py`.
2021-01-07 11:57:30 +00:00
Chris Hill-Scott
8302b2b667 Validate length of broadcast content
Depends on:
- [ ] https://github.com/alphagov/notifications-utils/pull/826/files

Adds error messages for when the content of a broadcast template is too
long.

The error message is explicit when this is cause by non-GSM characters.
We may not want to expose this complexity to our users, but it’s useful
for now while we’re testing things out.
2020-12-29 11:29:57 +00:00
Tom Byers
97bc2817bc Merge pull request #3731 from alphagov/add-govuk-radios-5
Add GOVUK radios [part 5]
2020-12-16 14:48:49 +00:00
Tom Byers
d620d9ea08 Hide legend on SetEmailBranding.branding_style
Effects all routes that use that form, or
SetLetterBranding, which inherits from it:
- /organisations/<service_id>/settings/set-letter-branding
- /organisations/<service_id>/settings/set-email-branding
- /<service_id>/service-settings/set-letter-branding
- /<service_id>/service-settings/set-email-branding
2020-12-15 12:08:09 +00:00
Tom Byers
e8a74b7ed1 Convert radios on set email branding page
Changes SetEmailBranding.branding_style to
GovukRadiosFieldWithNoneOption.
2020-12-11 13:58:40 +00:00
Tom Byers
d911c1a707 Add GovukRadiosFieldWithNoneOption 2020-12-11 13:58:40 +00:00
Katie Smith
57189f57e4 Add form validation for max service and org name
There was a recent error in the logs because a service tried to change
its name to one exceeding 255 characters (which is a limit on the
database field). We can easily catch these errors on the form, so that
the user doesn't see an error page.
2020-12-11 11:33:34 +00:00
Tom Byers
b1d0d216e0 Convert radios on add org page
Changes OrganisationCrownStatusForm.crown_status.

This also effects NewOrganisationForm, which
inherits from OrganisationCrownStatusForm.

Because of that this commit also updates the
template used for the edit org crown status page,
which uses NewOrganisationForm for its form.
2020-12-10 10:19:50 +00:00
Tom Byers
0cdbb850aa Convert radios in edit org type page (basic)
Changes the OrganisationTypeField class used by
OrganisationOrganisationTypeForm.organisation_type

OrganisationTypeField is also used by the forms in
/add-service:
- CreateServiceForm
- CreateNhsServiceForm

Because of that, this commit also includes changes
to the template for that route.

Note: this also moves where OrganisationTypeField
appears in app/main/forms.py so it can use
GovukRadiosField.
2020-12-10 10:19:49 +00:00
Tom Byers
58149ce34c Convert radios on SMS prefix page
Includes changing form.enabled to use
OnOffField, for consistency with other on/off
fields.

OnOffField's data is a boolean, not a string, so
some of the logic using it needed to be changed.
2020-12-09 15:03:43 +00:00
Tom Byers
b917fa3c74 Make OnOffField inherit from GovukRadiosField
Means that ServiceOnOffSettingForm.enabled ends up
using the GovukRadiosField methods for rendering.
2020-12-09 15:03:43 +00:00