Commit Graph

3153 Commits

Author SHA1 Message Date
Leo Hemsted
efd976e32e downgrade non-gsm chars in SMS previews
bump utils to 13.8.0

we still save the content as the user intended, and they'll still see
that content in the text field if they go to edit the template, but
the SMS previews will appear as they will on a user's phone
2017-02-20 12:03:16 +00:00
Chris Hill-Scott
fea7758eaf Merge branch 'master' into gsm 2017-02-20 10:14:33 +00:00
Chris Hill-Scott
1f679a95be Merge pull request #1137 from alphagov/bump-utils-no-markdown-links
Bump utils to turn off Markdown links
2017-02-17 16:29:40 +00:00
Leo Hemsted
f550699daf fix non-gsm error message
Use `it`/`they` depending on how many different characters you've used
Also don't wrap the message with quotes, as it looks confusing and
potentialy implies that you can't use apostrophes
2017-02-17 10:39:52 +00:00
Leo Hemsted
9046ec3bbc ensure emails still accept emoji 2017-02-17 10:39:52 +00:00
Leo Hemsted
6f8568b904 add tests for gsm handling in save/edit template 2017-02-17 10:39:52 +00:00
Leo Hemsted
73a965a3c6 allow downgradeable unicode characters in SMS templates 2017-02-17 10:39:52 +00:00
Leo Hemsted
c25fff9032 add tests for formatted_list 2017-02-17 10:39:52 +00:00
Leo Hemsted
41fa158635 error when users put non-GSM chars in a sms template
additionally, this moves the formatted_list jinja macro into a python
function, so that it can be called from the form validator
2017-02-17 10:39:52 +00:00
Leo Hemsted
cb54db82b4 Merge pull request #1128 from alphagov/test-permission-fix
Fix permissions in tests
2017-02-17 10:39:32 +00:00
Leo Hemsted
05e3a61f9b fix additional test permissions 2017-02-17 09:57:58 +00:00
Leo Hemsted
bbeb3595a8 update tests to work with new correct logged_in_client fixtures
mostly making sure that the correct user is set up. some minor changes,
such as giving the platform_admin service permissions (so that we can
test that platform admins can send letters)
2017-02-17 09:44:53 +00:00
Leo Hemsted
61cbdac09d remove mock_has_permissions from logged_in_client
mock_has_permissions blindly returns True - this is useful for the
decorators on most endpoints checking if the user has permission to
access endpoints about the provided service, but is not useful when
it returns true to such checks as "if user is platform admin, show
secret stuff", despite the logged in user being
"active_user_with_permissions" rather than a platform admin.

So remove this, and add "logged_in_platform_admin_client" for when we
want to explicitly check platform admin functionality.

This has the advantage of the actual permissions code being checked
in tests, so the test environment is more consistent with the real
world.

Several tests will have to change now though - active_user_with_perms
has permissions for service_one, so most tests should now call
client.get(url_for(..., service_id=service_one['id']) or they'll 403
2017-02-17 09:44:53 +00:00
Chris Hill-Scott
7a3fb4d2a9 Bump utils to turn off Markdown links 2017-02-16 21:18:27 +00:00
Andras Ferencz-Szabo
af1befe248 Merge pull request #1130 from alphagov/paas_awslogs
Add awslogs logging for PaaS
2017-02-16 17:20:20 +00:00
Chris Hill-Scott
221d401289 Merge pull request #1136 from alphagov/sign-in-message
Show a more useful message if you get signed out
2017-02-16 15:33:33 +00:00
Chris Hill-Scott
6977afb703 Merge pull request #1135 from alphagov/fix-recipient-column-error
Fix error message when recipient column missing
2017-02-16 15:33:24 +00:00
bandesz
b148a0a6a0 Add awslogs logging for PaaS 2017-02-16 14:19:37 +00:00
Chris Hill-Scott
fb33255bd0 Show a more useful message if you get signed out
> Users that allow their session to expire, or access a bookmarked link
> are told they need to "Sign in to access this page" - we should
> explain that it's because they've been away a while, so that they
> understand why they're being asked to log in again.

– https://www.pivotaltracker.com/story/show/140016919

The message we were showing before (Please log in to access this page is
the default message from Flask Login).

In order to stop this flash message from appearing, we need to override
the default handler for when a user is unauthorised. We’re overriding it
with the same behaviour, minus the flash message.

If you navigate deliberately to the sign in page it’s unchanged.

Content is Sheryll-approved.
2017-02-16 13:33:32 +00:00
Leo Hemsted
492f8bee0f Merge pull request #1134 from alphagov/strong-2fa-security
Strong 2fa security
2017-02-16 13:11:48 +00:00
Chris Hill-Scott
176d0f4867 Fix error message when recipient column missing
When your CSV file is missing the recipient column (eg ‘phone number’
or ‘email address’) we give you a helpful error message telling you that
this is the case.

When we changed the recipient column to be columns, plural, we didn’t
update the code that generated the error message. So you would get
errors that looked this like this:

> Your file needs to have a column called ‘’

This commit fixes the error message.
2017-02-16 11:12:34 +00:00
imdadahad
c8a05df586 Merge pull request #1126 from alphagov/fix-clear-instance-before-deploy
Remove app and py3 packages on codedeploy-ment
2017-02-15 16:54:52 +00:00
Rebecca Law
fc66d62c3f Merge branch 'master' into strong-2fa-security 2017-02-15 16:11:48 +00:00
Rebecca Law
cf3a933b1e Updated error message is the code is not the right size or data type.
Updated two_factor to error is the user account is locked (locked = over 10 failed_login_count)
2017-02-15 14:56:22 +00:00
Chris Hill-Scott
3e18d13ca2 Merge pull request #1132 from alphagov/fix-single-template-usage
Don’t right align template stats for one template
2017-02-15 14:10:52 +00:00
Chris Hill-Scott
6404997b93 Don’t right align template stats for one template
We don’t show the graph if a user has only used one template.
2017-02-15 14:01:52 +00:00
Chris Hill-Scott
f851da36f7 Merge pull request #1131 from alphagov/fix-template-graph-width
Make template usage graph take up 100% of width
2017-02-15 13:46:50 +00:00
Chris Hill-Scott
008b9b4cef Make template usage graph take up 100% of width
The bars were sitting in a table cell with some right padding, so they
never extended all the way to the right. Making it right-aligned removes
this padding, then setting the text to left aligned keeps things looking
the same.
2017-02-15 13:24:21 +00:00
Chris Hill-Scott
562a93b9b1 Merge pull request #1129 from alphagov/aria-tabs-pill-navigation
Mark up ‘pill’ component as being tabs
2017-02-15 13:16:30 +00:00
Chris Hill-Scott
f64c241a97 Merge pull request #1127 from alphagov/skiplink-product-page
Fix missing skiplink target on product page
2017-02-15 13:16:07 +00:00
Chris Hill-Scott
2ecfc2bb80 Fix invalid nesting of HTML elements
In HTML you generally can’t nest an inline level element inside a block
level one, if you want your HTML to validate.

There were a couple of places where we were using a `<span>` as a
containing element:
- inside every table cell (think we inherited this from Digital
  Marketplace)
- in the ‘pill’ navigation component for the selected tab

This meant that when we put components like big number inside these,
the resulting HTML was invalid, because big number is built with a bunch
of `<div>`s, which are block level.

This commit removes the use of a `<span>` tag in these places, and
replaces it with a `<div>`. Nesting block level elements in fine in
HTML.
2017-02-14 15:19:08 +00:00
Chris Hill-Scott
3e89baf117 Mark up ‘pill’ component as being tabs
Currently it’s not possible for a screen reader user to know which
financial year they’re looking at. From the accessibility report:

> The financial year links are contained in a navigation region -
> tabbing or arrowing through only reads out the links, not the main
> information of "2016 to 2017 financial year" - that information is
> vital for understanding the page content.

This problem also applies to other pages which use the `pill` component,
which is effectively tabbed navigation (that reloads the page rather
than showing or hiding content on the page).

There are specific ARIA attributes that can be used to mark up a
navigation as being tabbed. This commit:

- adds those attributes
- makes the selected ‘tab’ visible to screenreaders and keyboard
  focusable
- adds a visual focus indicator to the selected tab
- adds `id`s to the parts of the page that are controlled by the tabs so
  that they are labelled as such

This also means changing the pill component from being a `<nav>` to a
`<ul>` because `tablist` is not a valid `role` for a `nav`.

Mostly follows the example here:
http://accessibility.athena-ict.com/aria/examples/tabpanel2.shtml
2017-02-14 15:18:37 +00:00
Imdad Ahad
4110d06e1f Cancel uninstalling python packages 2017-02-14 12:17:03 +00:00
Chris Hill-Scott
25227d89bd Merge branch 'fix-nested-labels' 2017-02-14 11:55:46 +00:00
Chris Hill-Scott
3f41090a94 Fix duplicate labels on form inputs
It’s invalid HTML to have multiple labels nested within each other. This
was happening by accident because WTForms tries to be clever – when you
put `{{ field.label }}` in a template it prints a `<label>` tag for you,
not just the text of the label. But we put our own `<label>` tags in the
HTML to have more control of them.

This commit stops WTForms being so clever.
2017-02-14 11:55:46 +00:00
Chris Hill-Scott
4fe08d342a Merge branch 'fix-self-closing-js' 2017-02-14 11:55:27 +00:00
Chris Hill-Scott
1c127f6fe0 Fix broken script tag
The HTML validator picks up this error in our code:
> Self-closing syntax (/>) used on a non-void HTML element. Ignoring
> the slash and treating as a start tag.
2017-02-14 11:55:27 +00:00
Chris Hill-Scott
27e5a71863 Merge branch 'turn-off-html-validation' 2017-02-14 11:55:05 +00:00
Chris Hill-Scott
8d116aaae3 Use valid HTML value for autocomplete attribute
We had a valid reason for setting this to `nope` (see
2124821e00). But it’s not valid HTML, so
got us a fail in the accessibility audit.
2017-02-14 11:55:05 +00:00
Chris Hill-Scott
01fdd1d034 Turn off HTML5 validation on registration form
We do our own server-side validation of things like email address. We
don’t want the browser also trying to do it based on the input type of a
form field. It’s bad because the browser validation message comes up as
a nasty little tooltip under the field.
2017-02-14 11:55:05 +00:00
Chris Hill-Scott
370fe24a83 Merge branch 'service-name-in-title' 2017-02-14 11:54:44 +00:00
Chris Hill-Scott
d1b53682cd Remove <h2> tag around service name in nav
The heading structure of most pages is incorrect (`<h2>` followed by
`<h1>`). The `<h1>` indicates the main purpose of the page, the service
name (currently the first `<h2>`) doesn't need to be a heading.
2017-02-14 11:53:53 +00:00
Chris Hill-Scott
135ff1ee77 Include service name in page <title>
In pages specific to a service (e.g. dashboard and sub pages) the title
needs to distinguish which service it applies to. This is mainly to give
context to screen reader users who could be managing multiple services.

Implementing this uses template inheritance:

`page_title` includes `per_page_title` includes `service_page_title`

‘GOV.UK Notify’ is inserted into every page title.

Pages that set `service_page_title` get the service name inserted too.
2017-02-14 11:53:53 +00:00
Chris Hill-Scott
72c8c759a5 Merge branch 'row-header-screenreader-text' 2017-02-14 11:51:38 +00:00
Chris Hill-Scott
549695de4e Add extra text to label rows for screenreaders
This is mainly for the ‘check’ page where we show users the contents of
their spreadsheet.

> The structure of the table means that the first cell is treated as a
> column header, so moving through columns in row 2 for example
> associates the data 2 with 1 (column header) - this has no logical
> meaning
2017-02-14 11:51:38 +00:00
Chris Hill-Scott
911617fb03 Merge branch 'add-error-summary' 2017-02-14 11:51:19 +00:00
Chris Hill-Scott
cd7cb8884c Send focus to error summary before single error
> If both sections of the page have errors and the page is submitted,
> focus moves to the mobile numbers section so screen reader users may
> not be aware of preceding errors - focus should move to a dedicated
> error summary at the top of the page.

Right now we use Javascript to focus the first error on a page (if any
errors are found). This commit adds more JS to then focus the error
summary, if there is one on the page. So this is where the focus will
rest.

It also makes some modifications to the ‘dangerous’ banner to make it
focusable, and to visually indicate that it is focused.
2017-02-14 11:51:19 +00:00
Chris Hill-Scott
d2918486e9 Add error summary to whitelist page
> If both sections of the page have errors and the page is submitted,
> focus moves to the mobile numbers section so screen reader users may
> not be aware of preceding errors - focus should move to a dedicated
> error summary at the top of the page.

This commit adds the dedicate error summary at the top of the page,
following the GOV.UK Elements style from:
http://govuk-elements.herokuapp.com/errors/
2017-02-14 11:51:19 +00:00
Chris Hill-Scott
d82017d8d3 Merge branch 'fix-banner-colour-contrast' 2017-02-14 11:50:57 +00:00
Chris Hill-Scott
5c98f87572 Fix colour contrast on confirmation banner
White on turquoise is not enough colour contrast to pass WCAG AA.
2017-02-14 11:50:57 +00:00