Commit Graph

11485 Commits

Author SHA1 Message Date
Chris Hill-Scott
fbf77a7482 Merge pull request #3902 from alphagov/webauthn-image
Designerise the pages for adding a security key
2021-06-01 15:10:52 +01:00
Chris Hill-Scott
77ea7af909 Fix double back link 2021-05-28 16:20:35 +01:00
Chris Hill-Scott
3f7124b04e Remove uneeded clearfix 2021-05-28 16:20:35 +01:00
Chris Hill-Scott
597846f657 Refactor error button and error messages into variable 2021-05-28 16:20:34 +01:00
Chris Hill-Scott
268a7d1881 Make image display smaller on mobile 2021-05-28 16:20:34 +01:00
Ben Thorner
68d923568c Merge pull request #3901 from alphagov/prevent-admin-auth-change
Prevent switching auth type for Platform Admins
2021-05-28 16:07:11 +01:00
Chris Hill-Scott
68e7d2916e Fix nesting of if statement 2021-05-28 13:52:05 +01:00
Chris Hill-Scott
7f88aa6759 Make listing of keys on user profile a bit nicer
We can use the `optional_text_field` macro to grey out the text when
nothing is set up. And adding ‘registered’ makes the language consistent
through to the next page.
2021-05-27 18:14:20 +01:00
Chris Hill-Scott
88e2cc93df Add image of security key
When referring to something that’s not part of the Notify system, like a
spreadsheet or a paper letter or a security key we’ve found it’s helpful
to give people a visual representation of it. This commit does the same
for security keys.
2021-05-27 18:14:20 +01:00
Rebecca Law
24f4b3f3eb Merge pull request #3899 from alphagov/bump-utils-new-invalid-address-char
Bump utils version for new invalid address character
2021-05-27 13:53:38 +01:00
Rebecca Law
9a4b6de37d Bump utils version for new invalid address character 2021-05-27 13:04:46 +01:00
Ben Thorner
71cbc00a3d Localise and simplify fixture to invite tests
This isn't used anywhere else.
2021-05-25 17:55:52 +01:00
Ben Thorner
754f4e3753 Use mock_check_invite_token consistently
In some tests the mock was already used, and then overridden but
without any change to the behaviour.
2021-05-25 17:54:37 +01:00
Ben Thorner
eb343e4937 Simplify test for API error with existing user
This is now covered since we use 'mock_no_users_for_service'.
2021-05-25 17:51:09 +01:00
Ben Thorner
c696693785 Simplify mocking and asserting the existing user
Previously we made surprising changed to the invited user as part
of the mock, and then surprising assertions that its ID matched
USER_ONE_ID. This simplifies the mock to do what it says, so that
we can test for the original ID of the existing user.*

*this does still differ from the ID of the sample_invite, which is
also hard-coded to USER_ONE_ID. However, this isn't relevant in
any of the tests, so doesn't seem to much of an issue.
2021-05-25 17:51:08 +01:00
Ben Thorner
ef2996d56a Localise fixture to the only test that uses it 2021-05-25 17:51:07 +01:00
Ben Thorner
1dcfd5ba95 Refactor accept invite test to avoid override
This replaces the original fixture with a more explicit one, noting
that none of the tests rely on this fixture as part of testing the
scenarios when a user is already a member of the service.
2021-05-25 17:51:05 +01:00
Ben Thorner
6d0d9d46f7 Prevent switching auth type for Platform Admins
This closes a security loophole, where the auth type of a Platform
Admin could be unwittingly changed when they accept an invite, or
by an admin of a service they are a member of.
2021-05-25 16:01:25 +01:00
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
04d1d97d4c Refactor loop to separate function and use user model
when getting a list of security keys

Also test separately that we are correctly choosing key out of list
of security keys. Previously we have done it as a part
of testing pages where where we were calling API to get a list
of keys, but then choosing one of those keys based on id.

Also remove redundant second test credential after PR review

Also remove redundant return value from mocks in update name tests
2021-05-25 14:17:58 +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
e384d3e0a1 Test all manage security keys pages against unauthorised access 2021-05-25 11:55:47 +01:00
Pea Tyczynska
724e345089 Do not call API if key name did not change
To avoid unnecessary calls to API.
2021-05-25 11:55:47 +01:00
Pea Tyczynska
a907f261a5 Catch last credential error from API
When we are unable to delete security key because it's the last
one for that user, API throws an error. Here we catch that error
and display useful message to the user.

Use security key instead of webauthn credential

in user facing message - for consistency and readability.

We use security key term in user facing stuff and webauthn
credential in the code.
2021-05-25 11:55:37 +01:00
Pea Tyczynska
a946ad6ec2 Let admin user delete their security key
Show confiem delete dialogue first to confirm if key should be deleted.
2021-05-25 11:40:42 +01:00
Pea Tyczynska
00c022eba5 Let admin user update their security key name 2021-05-25 11:40:41 +01:00
Pea Tyczynska
56eac279df Show manage security key page with name change form 2021-05-25 11:40:41 +01:00
Pea Tyczynska
c33465e7cf Add link and placeholder view for managing a security key 2021-05-25 11:40:33 +01:00
David McDonald
9d2f495df8 Merge pull request #3900 from alphagov/make-help
Add help text for new make steps
2021-05-25 11:31:39 +01:00
David McDonald
f4dc9e15e1 Add help text for new make steps
Helpful for when you run `make` as you've forgotten what the command is
and you don't want to go find the readme
2021-05-25 11:21:39 +01:00
Chris Hill-Scott
2d2c82ca87 Merge pull request #3885 from alphagov/live-broadcast-tour
Add a version of the tour for live services
2021-05-24 10:58:45 +01:00
Andrew White
438b7457cd Merge pull request #3895 from alphagov/disable-statistics-check
Disable the remaining messages check for uploads
2021-05-22 07:34:08 +01:00
Andrew White
00c3943222 Disable the remaining messages check for uploads
The HTTP request for the statistics is taking more 30 seconds which leads to 504 errors from CloudFront.
2021-05-22 07:25:07 +01:00
Ben Thorner
658e40b6c5 Merge pull request #3883 from alphagov/rename-app_-2
Rename "app_" fixture to "notify_admin"
2021-05-19 11:53:09 +01:00
Chris Hill-Scott
5de1c4f6ca Redirect newly-created users to broadcast tour 2021-05-19 11:48:59 +01:00
Chris Hill-Scott
7697cdb2b3 Combine tests using parametrize 2021-05-19 11:48:59 +01:00
Chris Hill-Scott
016f38db9b Refactor service name code to reduce duplication
This makes the code shareable between:
- the broadcast tour pages
- the broadcast settings platform admin page
- the regular service navigation

On the training mode tour pages we don’t want to confuse people with the
organisation name or _Switch service_ links, so those are omitted and
the code is therefore slightly different.
2021-05-19 11:48:59 +01:00
Ben Thorner
5bfce61bcf Rename "app_" fixture to "notify_admin"
This naming was introduced in 2016 without explanation [1]. I find it
confusing because:

- It's reminiscent of "_app", which is a Python convention indicating
the variable is internal, so maybe avoid using it.

- It suggests there's some other "app" fixture I should be using (there
isn't, though).

The Python style guide describes using an underscore suffix to avoid
clashes with inbuilt names [1], which is sort of applicable if we need
to import the "app" module [2]. However, we can also avoid clashes by
choosing a different name, without the strange underscore.

[1]: 3b1d521c10
[2]: 78824f54fd/tests/app/main/views/test_forgot_password.py (L5)
2021-05-19 11:44:20 +01:00
Ben Thorner
03295eb828 Merge pull request #3889 from alphagov/webauthn-errors
Handle errors when registration fails
2021-05-19 11:22:05 +01:00
Chris Hill-Scott
766df5d1ca Add a version of the tour for live services
At the moment if you’re invited to a live broadcast service you get the
training mode tour. This is misleading, and could make people think they
weren’t in danger of sending a real alert.

This commit adds a short, 2 step tour for users invited to a live
broadcast service.
2021-05-19 09:41:58 +01:00
Chris Hill-Scott
af4bdf4620 Merge pull request #3881 from alphagov/confirm-live-broadcast
Add a confirmation checkbox for live broadcasts
2021-05-19 09:19:45 +01:00
Chris Hill-Scott
f10e3661b9 Remove duplicative test
Duplicated the assertions in `test_request_approval`
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
ef79edba09 Remove uneccessary parametrize
It proves the behaviour isn't dependent on the channel, but there are
other variables we could equally prove that for, which we're not testing
here.
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
8db280317f Rename helper method
This is ambiguous, as it's not used in a lot of the views.

There’s precendent for naming these kind of methods here:
06cc5b58c7/app/main/views/broadcast.py (L238)
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
cee2a4cb7f Remove check for ARIA role
This is testing something built into GOV.UK Frontend, we don’t need to
test it ourselves.
2021-05-18 15:58:41 +01:00
Chris Hill-Scott
859674db38 Remove duplicative test
This case was already covered by `test_confirm_approve_non_training_broadcasts_errors_if_not_ticked`
2021-05-18 15:58: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
Ben Thorner
773a51dec1 Merge pull request #3891 from alphagov/try-fix-webauthn-js
Only check for WebAuthn where it's used
2021-05-18 13:36:50 +01:00
Ben Thorner
4575ad0fcd Only check for WebAuthn where it's used
This scopes the check for WebAuthn API to the page where we need
it, which will slightly reduce load times for other pages. Since
we want this script to execute ASAP, I've added a new block for
extra JS to run at the start of the body.
2021-05-18 13:01:45 +01:00