Commit Graph

583 Commits

Author SHA1 Message Date
Rebecca Law
cffd66c62e Updated the api_client call to send_verify_code
The api has now has an user/<user_id>/email-code and user/<user_id>/sms-code
This commit requires an update to the python-client. Make sure the PR for that version has been merged first and the tag push using scripts/push_tag.sh
2016-02-19 16:08:44 +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
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
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
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
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
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
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
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
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
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
Rebecca Law
3a89039795 Remove need for TWILIO_TEST_NUMBER 2016-02-09 15:56:09 +00:00
NIcholas Staples
25f74b79bf Merge pull request #164 from alphagov/swap-3fa-fields
Swap order of fields of three factor page
2016-02-09 10:58:23 +00:00
NIcholas Staples
52ef4cb83e Merge pull request #163 from alphagov/syntax-highlight-docs
Add syntax highlighting to code examples in docs
2016-02-09 10:55:31 +00:00
Chris Hill-Scott
ff400d7857 Swap order of fields of three factor page
Most people seem to get the text message before the email, so it makes sense
for this to be the first field on the page.
2016-02-09 10:49:28 +00:00
Chris Hill-Scott
7e8046be47 Add syntax highlighting to code examples in docs
Uses the Pygments[1] package.

1. http://pygments.org/
2016-02-09 10:33:49 +00:00
NIcholas Staples
2da67fa78f Merge pull request #162 from alphagov/allow_test_number
Allow test number
2016-02-08 16:56:10 +00:00
Rebecca Law
05adb1f3ad Add test number for functional testing. 2016-02-08 15:22:19 +00:00
Adam Shimali
06d9c1f7d3 Merge pull request #161 from alphagov/template-content-fix
Restore template content when deleting template
2016-02-08 13:40:47 +00:00
Adam Shimali
3b7d1f9d12 Merge pull request #160 from alphagov/front-end-lint
Add linting for SASS and Javascript
2016-02-08 13:37:45 +00:00
Chris Hill-Scott
de6ed99006 Restore template content when deleting template
When the template content was renamed in
9ee8610da0 I missed doing the same change for the
delete template route.

This commit does the same fix, so that template content is still visible when
you’re about to delete a template (so you can make sure it’s the right one).
2016-02-08 12:35:18 +00:00
Chris Hill-Scott
3f365058ef Fix problems found by SASS Lint 2016-02-08 12:02:22 +00:00
Rebecca Law
d57e54874d Merge pull request #157 from alphagov/s3-errors
In case there are problems reading back the csv file from
2016-02-08 10:51:48 +00:00
Adam Shimali
cae5418a6d Merge pull request #159 from alphagov/edit-template-textbox-width
Make ‘edit template’ textboxes the same width
2016-02-08 10:47:20 +00:00
Chris Hill-Scott
d1a7c8ef39 Make ‘edit template’ textboxes the same width
This involves:
- removing the hard coded width on any textbox that does placeholder
  highlighting
- adding JS to make sure that the extra layers on top of the textbox inherit
  the width of the textbox that the user types in (so the layers don’t get
  misaligned)

Keeping the textboxes at 2/3 width for consistency with how wide the messages
are on the ‘manage templates’ page.
2016-02-08 10:03:30 +00:00