Commit Graph

307 Commits

Author SHA1 Message Date
Rebecca Law
2905d11fe4 Get users for service to show on the manage team page.
Calls api endpoint /service/<service_id>/users to retrieve all users associated with the service
2016-02-24 17:32:15 +00:00
Chris Hill-Scott
bc1899e8c0 Make email pattern work in new context
The email pattern looked a bit shonky when displayed in a narrower column. This
commit fixes it by making the email’s metadata (eg subject, from) into a table,
which it sort of is. This means that it is more flexible about the size of
container in which it sits.
2016-02-24 09:23:38 +00:00
Chris Hill-Scott
1e46922876 Make send the send flow generic
This commit parameterises all methods in the send view so that they can send
either emails or SMS messages.

It works out what kind of message it is sending from the `template_type`
property of the template object.

This means that the `Template` util class needs to know about these properties,
which means that this commit depends on:
https://github.com/alphagov/notifications-utils/pull/2

This commit does _not_ add tests for sending emails. The existing tests for
sending SMS still pass, but actually sending emails is outside the scope of
this story.
2016-02-24 09:23:38 +00:00
Chris Hill-Scott
aaa6317371 Rename SMS to send
Because this view is no longer just for sending SMS messages, it and its
associated tests should be renamed, so `send_sms.py` becomes `send.py`, etc.
2016-02-24 09:23:38 +00:00
Chris Hill-Scott
c6de605311 Add basic flow for adding email _or_ sms templates
Templates now have:
- a type (email or sms)
- a subject (if they are email templates)

We don’t want two completely separate view files for email and SMS, because they
would have an enormous amount of repetition.

So this commit adds
- different templates for SMS and email templates
- different form objects for SMS and email templates

…and wires them up.
2016-02-24 09:23:38 +00:00
Chris Hill-Scott
31b60730d3 Put banner on the choose sms template page 2016-02-23 11:49:47 +00:00
Adam Shimali
6c56f9be31 Add count of rows in csv file as a notification count. 2016-02-22 14:53:37 +00:00
Chris Hill-Scott
97a3bf9225 Remove the ‘manage templates’ page
The ‘manage templates’ page was almost identical to the ‘send text messages’
page.

This commit consolidates them into one and makes them all hang together.

Part of this means tweaks to the javascript so that files upload as soon as
you’ve chosen them.
2016-02-22 13:39:02 +00:00
Chris Hill-Scott
bf3f6d7d3e Fix users page for research
For the lab sessions, users should just see themselves as the only user, not
all the fake users (it might confuse them).
2016-02-22 13:39:02 +00:00
Chris Hill-Scott
65dc7578e5 Updates to styleguide
Brings in changes to the email message and table patterns.
2016-02-22 13:39:02 +00:00
Chris Hill-Scott
17b99c9bf2 Add pages to invite, edit, and delete users
This takes the original prototype version of this page, and, using the same
fake data (ie nothing is wired up):
- adds an invite users page
- adds an edit (and delete) user page

Both these pages allow the user to set another user’s permissions.

This commit adds images for the ticks and crosses, so we have control over their
appearance.
2016-02-22 13:39:02 +00:00
Adam Shimali
a86be302ce Merge pull request #186 from alphagov/email-templates
Email templates
2016-02-22 13:34:45 +00:00
Nicholas Staples
980c01e10c Fix bug with send_verify_code not including the to field. 2016-02-22 12:33:59 +00:00
Chris Hill-Scott
73deae9bff Preview service name when adding a new service
This commit adds a new page, which appears after a user enters the name for
their new service. It shows how the service name will appear in emails and
text messages.

This means that the new service is not created until after they have confirmed
that the name is appropriate in context.

This has also involved:
- visual changes to the ‘email template’ pattern, which wasn’t very refined
  before
- removing a bunch of words from the enter service name page, because most users
  don’t read them, and we reckon that showing a preview is a better way of
  getting them to understand what is meant by service name

Still to do:
- validating the the generated email address for a service is unique (on the
  API) side
- having the API return the generated email address, rather than determining it
  in the admin app
2016-02-19 16:38:46 +00:00
Martyn Inglis
6616182ab3 Slight changes to match new API features:
- get user now throws a 404 so handle that
- making a service now needs one user not many to create
2016-02-19 16:38:08 +00:00
Nicholas Staples
32e37d89fb User permissions added with test. 2016-02-19 16:38:04 +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
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
Adam Shimali
787fa457b5 Fix missing import 2016-02-17 09:51:54 +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
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
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
Rebecca Law
3a89039795 Remove need for TWILIO_TEST_NUMBER 2016-02-09 15:56:09 +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
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
Adam Shimali
3bd2565129 In case there are problems reading back the csv file from
s3 bucket flash error message instead of stack trace from s3 client.
2016-02-05 16:13:06 +00:00
Chris Hill-Scott
939954cd64 Skip ‘choose service’ page if user has one service
We used to do this by redirecting on the choose service page. However when we
lost the dropdown and this page also became the page for adding a new service
(in 3617f2e936) the redirect was removed.

This commit re-adds the redirect on the two factor page, so that it only happens
on first login.

So the flows are:

**Multiple services**
```
`Sign in` → `Enter two factor code` → `Choose service` → `Service dashboard`
```

**One service**
```
`Sign in` → `Enter two factor code` → `Service dashboard`
```

**No services (you’ve deleted all your services)**
`Sign in` → `Enter two factor code` → `Choose service` → `Add new service`
2016-02-05 14:50:55 +00:00
NIcholas Staples
7854617453 Merge pull request #155 from alphagov/fixes-to-front-end-patterns
Fixes to front end patterns
2016-02-05 11:39:46 +00:00
Adam Shimali
5555e07b32 Merge pull request #154 from alphagov/jobs-on-dashboard
Limit number of jobs on dashboard to 5
2016-02-05 11:22:17 +00:00
Chris Hill-Scott
7dc5d76b98 Use banners appropriately
We’ve fiddled around with the banners quite a lot in the last few days. This
commit reviews some of the older examples and makes sure that they’re:

a) not broken
b) using the most appropriate banner for the context
2016-02-05 10:43:49 +00:00
Chris Hill-Scott
7e670d9662 Limit number of jobs on dashboard to 5
…and add a link to view the rest of the jobs if there are more than 5.
2016-02-04 17:25:29 +00:00
Chris Hill-Scott
7399c3c6c0 Add a flash message to confirm sending has started 2016-02-04 15:29:36 +00:00
NIcholas Staples
cf08f4ef2a Merge pull request #150 from alphagov/send-text-flow-revised
Send text flow revised
2016-02-04 14:57:43 +00:00
Chris Hill-Scott
a7d6d85d8b Make first page of ‘send texts’ use links not form
This doesn’t need to be a form—it’s not changing any data.

And having the primary action on the page as ‘Use this template’ it makes it
clear what the page is for.
2016-02-04 14:13:57 +00:00
Chris Hill-Scott
26adcc64c1 Updates to ‘send SMS’ page
Based on discussion with Pete.

Make the blue banner an ‘important’ banner (copied from Register to Vote, used
because it’s not as boxy and fits on the page better).

Remove the back button because you haven’t changed any data yet. If you need to
go back you can just press back or start again.

Make the filename stand out more.

Remove the ‘download example’ link. Will need to revist the best way of doing
this.

Make text messages consistently 2/3rd width.
2016-02-04 14:06:19 +00:00
Rebecca Law
4c461b9dbe Merge pull request #151 from alphagov/job-id-bug-fix
Service and job id were incorrectly in bucket name.
2016-02-04 12:16:07 +00:00