Commit Graph
13107 Commits
Author SHA1 Message Date
NIcholas Staples f761afa76e Merge pull request #182 from alphagov/prefil-placeholders
Prefil placeholders
2016-02-19 09:37:08 +00:00
Chris Hill-Scott 5af03b28f3 Remove the weird table from the send SMS page
It was weird.
2016-02-18 17:33:43 +00:00
Chris Hill-Scott 8123359eb2 Prefill placeholders for test message
If you want to send yourself a test message from a template that has
placeholders you can’t, at the moment.

Rather than forcing you to upload a CSV, we should prefil the data, and then
you only need to upload a CSV if you want to customise it.
2016-02-18 17:32:32 +00:00
Rebecca Law cfef82bfaa Merge pull request #181 from alphagov/test-text
Add flow for sending yourself a text message
2016-02-18 17:19:05 +00:00
Chris Hill-Scott a5945969c9 Add tests for new routes 2016-02-18 17:03:32 +00:00
Chris Hill-Scott eec56c2778 Add flow for sending yourself a text message
This commit adds a shortcut, which (in the background) does the creation and
uploading of a CSV file for you.

This enables users to send themselves a test message without having to fiddle
about with CSV files.
2016-02-18 15:59:57 +00:00
Chris Hill-Scott 2a9f9dcc57 Add a hint about how to use placeholders
Since placeholders (almost) work now, it’s worth telling people what the syntax
is.

This commit also removes the ‘template type’ picker, since you can only create
SMS templates at the moment. This will be revisited when we start looking at how
you add an email template.
2016-02-18 15:57:09 +00:00
Rebecca Law 3dea04d0c0 Merge pull request #180 from alphagov/use-template-util
Use Template util to replace, highlight and validate CSV files
2016-02-18 15:56:25 +00:00
Chris Hill-Scott 29dc039786 Skip initial space when parsing CSVs 2016-02-18 15:50:28 +00:00
Chris Hill-Scott 426a23decd Add a hint about how to use placeholders
Since placeholders (almost) work now, it’s worth telling people what the syntax
is.

This commit also removes the ‘template type’ picker, since you can only create
SMS templates at the moment. This will be revisited when we start looking at how
you add an email template.
2016-02-18 15:23:14 +00:00
Chris Hill-Scott 45cacd82d3 Validate CSVs fully
This commit extends the existing function to validate each row’s phone number
to also validate that all the required data is present.

It does this using the checking that the `Template` class can do when given
a template and a `dict` of values.
2016-02-18 15:07:15 +00:00
Chris Hill-Scott efb2140bbb Check CSV files match the template
This commit adds a first stab at checking whether a CSV file has the right
data to fill the placeholders.

The UI is very much first bash, but I’d like to get this merged and see how it
feels. The main thing is that we’ve got all the bit in place now to do this
logic.
2016-02-18 15:07:14 +00:00
Chris Hill-Scott 2d55bb7ae2 Use Template to replace/highlight placeholders
This commit brings in the `Template` util, added here:
https://github.com/alphagov/notifications-utils/pull/1

It also does a fair bit of tidying up, which I’ve unfortunately squashed into
this one massive commit. The main change is moving 404 handling into the
templates dao, so that every view isn’t littered with `try: … except(HTTPError)`.

It also adds new features, in a prototypy sort of way, which are:
- download a prefilled example CSV
- show all the columns for your template on the 'check' page
2016-02-18 15:07:14 +00:00
NIcholas Staples b7c226e2a8 Merge pull request #179 from alphagov/npm-govuk-template
Install GOV.UK Template with NPM
2016-02-17 14:43:12 +00:00
Chris Hill-Scott 7ecc3a4821 Install GOV.UK Template with NPM
Since https://github.com/alphagov/govuk_template/pull/193 the Jinja version of
the GOV.UK Template is published with a `package.json`. This means
- we can consume it via NPM
- so we can get rid of Bower

Which is what this commit does.
2016-02-17 14:27:05 +00:00
NIcholas Staples 23e38bfb6e Merge pull request #177 from alphagov/easier-registration
Make registration and forgot password pages better
2016-02-17 11:05:17 +00:00
Chris Hill-Scott e0e445c520 Stop enumeration of email addresses via forgot pw
https://www.pivotaltracker.com/story/show/113840073

Previously the forgot password page would give an error if you entered an email
address which didn’t belong to an account.

This would allow a potential attacker to know which email addresses were
registered.

This commit changes the response to always be the same, whether or not the email
address exists.

Also, this is a good read about the dangers of asserting whether a mocked method
was called: http://engineeringblog.yelp.com/2015/02/assert_called_once-threat-or-menace.html
2016-02-17 10:42:15 +00:00
Chris Hill-Scott 6a39c8e187 Use typographic quotes
http://smartquotesforsmartpeople.com
2016-02-17 10:42:14 +00:00
Chris Hill-Scott 6b4ede629c Use correct HTML 5 input types
These give devices a hint (although don’t mandate them) to use a numeric keypad,
or a keypad with the `@` symbol visible when entering phone numbers or email
addresses.
2016-02-17 10:42:14 +00:00
Chris Hill-Scott 2124821e00 Don’t allow autocomplete on register page
This is a potential attack vector which was highlighted by the pen test.

Setting autocomplete to `nope` (or any random string) is the most comprehensive
way of telling browsers not to autocomplete a form according to:
https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
2016-02-17 10:41:03 +00:00
Rebecca Law e5dbd4a077 Merge pull request #178 from alphagov/import-fix
Fix missing import
2016-02-17 10:20:58 +00:00
Adam Shimali 787fa457b5 Fix missing import 2016-02-17 09:51:54 +00:00
NIcholas Staples 78fe2b463a Merge pull request #176 from alphagov/styleguide-updates
Updates to styleguide
2016-02-15 12:00:44 +00:00
Chris Hill-Scott 41f09e2934 Merge pull request #175 from alphagov/fix_cookie_2025_bug
Fix for bug of cookie expiry.
2016-02-15 11:53:20 +00:00
Chris Hill-Scott 0d86be0feb Don’t show styleguide on live environment
Its audience is people working on the product, not the end users.
2016-02-15 11:48:04 +00:00
Nicholas Staples 2d4d88f9de Fix for bug of cookie expiry. 2016-02-15 11:43:16 +00:00
Chris Hill-Scott 10a92258a4 Make page heading a link to preview
Mainly because it looks good when this page is printed and stuck on the wall.
2016-02-15 11:41:46 +00:00
Chris Hill-Scott 97304a6681 Remove ‘info’ banner type
We’re not using this banner type anywhere any more
2016-02-15 11:37:40 +00:00
Chris Hill-Scott 3ee09d03bd General updates to styleguide
More complete examples of:
- tables
- SMS messages
2016-02-15 11:37:08 +00:00
NIcholas Staples 5928c3bb2c Merge pull request #174 from alphagov/clear-cookie-on-sign-out
Use session.clear()  sign-out.
2016-02-12 16:01:31 +00:00
Rebecca Law 035d4152fd Use session.clear() sign-out.
NOTE: you can not test that the session is cleared out by checking the session cookie does not exist on the index page,
because ItsDangerousSession will create a new session when it hits the index page. The unit test confirms that the session has been cleared.
2016-02-12 15:06:54 +00:00
Rebecca Law 8d1cd930ef Merge pull request #170 from alphagov/main-is-main
Use <main> element in semantically appropriate way
2016-02-12 09:49:11 +00:00
Rebecca Law db16e2583e Merge pull request #171 from alphagov/add-cachebusting-for-assets
Make URLs for assets cache-proof
2016-02-12 09:48:38 +00:00
Rebecca Law 8d6c61f3ad Merge pull request #172 from alphagov/upgrade_notifications_python_client
notifications-python_client upgraded to 0.2.5
2016-02-12 09:46:15 +00:00
Rebecca Law 8e85dae7fd Merge pull request #173 from alphagov/invalid_validation_code_fails
Fix error with invalid token causing an error.
2016-02-12 09:45:44 +00:00
Nicholas Staples 737e490276 Fix error with invalid token causing an error. 2016-02-11 16:23:41 +00:00
Nicholas Staples 92b0d74a25 Tests fixed. 2016-02-11 16:04:50 +00:00
Nicholas Staples dbdd689f8d Fix for forgotten password. 2016-02-11 15:59:28 +00:00
Nicholas Staples 48368584d9 notifications-python_client upgraded to 0.2.5 2016-02-11 15:27:08 +00:00
Chris Hill-Scott fc09750662 Cache static files for a year
We only want static files to not come from the browser cache when they have
changed. The best way to do this is by cache busting the URLs.

Otherwise, we want static files to be cached for a long time. This commit sets
the `Expires` HTTP header to 1 year in the future.

Previously it was set to 12 hours, the default.

From the Flask docs:
> Default cache control max age to use with send_static_file() (the default
> static file handler) and send_file(), in seconds. Override this value on a
> per-file basis using the get_send_file_max_age() hook on Flask or Blueprint,
> respectively. Defaults to 43200 (12 hours).
2016-02-10 16:07:10 +00:00
Chris Hill-Scott 2f0cc99610 Make URLs for assets cache-proof
https://www.pivotaltracker.com/story/show/113448149

This commit adds a query string to assets URLs which is generated from a hash
of the file contents. When asset files are changed they will now be served from
a different URL, which means they wont be loaded from browser cache.

This is similar to how GOV.UK template adds its version number as a querystring
parameter for its assets.

This is mostly copied from Digital Marketplace utils:
https://github.com/alphagov/digitalmarketplace-utils/pull/102

They have it in a shared codebase, we only have one frontend app so don’t need
to do that.

Usage in a template:
``` jinja
{{ asset_fingerprinter.get_url('stylesheets/application.css') }}
```

Output:
```
static/stylesheets/application.css?418e6f4a6cdf1142e45c072ed3e1c90a
```
2016-02-10 16:00:29 +00:00
Chris Hill-Scott 8e607debd4 Use <main> element in semantically appropriate way
Assistive technologies use the `<main>` element to navigate around a document.
In `<main>` their users expect to find:

> [content] unique to the document, excluding any content that is
> repeated across a set of documents such as sidebars, navigation links,
> copyright information, site logos, and search forms…
— https://developer.mozilla.org/en/docs/Web/HTML/Element/main

Previously, the `<main>` element also wrapped the sidebar navigation. This
commit moves the `<main>` element to only wrap the content of the page when the
page has a navigation sidebar.

This commit also removes the `page-container` class which wasn’t being used for
anything.
2016-02-10 12:33:11 +00:00
NIcholas Staples 5fd8ca492d Merge pull request #168 from alphagov/mask-phone-number-jobs-page
Make job page more realistic for demo
2016-02-10 12:19:47 +00:00
NIcholas Staples a9064b51b8 Merge pull request #169 from alphagov/tabluar-big-number
Use tablular numbers for ‘big number’ pattern
2016-02-10 11:21:22 +00:00
Chris Hill-Scott bd33fa3c26 Use tablular numbers for ‘big number’ pattern
> Tabular numbers have numerals of a standard fixed width. As all numbers have
> the same width, sets of numbers may be more easily compared. We recommend
> using them where different numbers are likely to be compared, or where
> different numbers should line up with each other, eg in tables.

The big number pattern is good candidate for tabluar numbers, especially if
we ever have these numbers update dynamically (in that case tabular numbers
won’t jump around like lining ones would).
2016-02-10 11:03:56 +00:00
Chris Hill-Scott fd052d5667 Make message sent, not queued, for realism 2016-02-10 09:46:02 +00:00
Chris Hill-Scott d7ac0fd12e Mask phone number on jobs page
The phone number on the job page is hard coded at the moment. This is not good
for the demo, and showing it is probably not good because we don’t want to be
storing it forever. So this commit:

- masks it out with bullets • because they’re nicer than asteriks
- adds a ‘row number’ column, which I think is good for users uploading CSVs
  to reconcile the job run with their data (if we’re not showing the data any
  more)
2016-02-10 09:40:05 +00:00
NIcholas Staples 1e60b7d635 Merge pull request #167 from alphagov/remove-test-number
Remove need for TWILIO_TEST_NUMBER
2016-02-09 16:11:42 +00:00
Rebecca Law 3a89039795 Remove need for TWILIO_TEST_NUMBER 2016-02-09 15:56:09 +00:00
NIcholas Staples 1880ca3c9e Merge pull request #166 from alphagov/quis-patch-1
Add all the configs
2016-02-09 14:14:20 +00:00