Commit Graph

790 Commits

Author SHA1 Message Date
Chris Hill-Scott
90d4fcaa52 Don’t let people create a normal key in trial mode
You can’t properly use a normal key when your service is in trial mode.

It’s theoretically useful to create a live key in preparation for going
live. This utitily outweighs the confusion it causes for people creating
their first keys in trial mode.

We should just remove the confusing option.
2016-10-10 14:40:13 +01:00
Leo Hemsted
b01323c28c fix query param testing once and for all. hopefully
try and avoid comparing URLs as much as possible cos its hard
2016-10-07 13:32:47 +01:00
Chris Hill-Scott
860b071f66 Test for query parameters in either order
They’re not deterministic, and were causing intermittant test failures.
2016-10-05 16:13:21 +01:00
Chris Hill-Scott
b760457ba9 Add monthly breakdown of usage
Basically:
- shows all the months from start of given financial year to now or end
  of given financial year (whichever is earliest)
- shows a breakdown of free and paid text messages for each of these
  months

Depends on:
- [x] https://github.com/alphagov/notifications-api/pull/699
2016-10-05 16:11:19 +01:00
Chris Hill-Scott
0a0bfa9232 Merge pull request #962 from alphagov/re-add-analytics
Re-add Google Analytics
2016-10-05 14:49:01 +01:00
Chris Hill-Scott
e095d6024c Revert "Remove Google Analytics"
This reverts commit f31170f5a2.
2016-10-05 10:55:04 +01:00
Chris Hill-Scott
3069858a9f Fix pagination on activity page
The activity page was AJAXified in
https://github.com/alphagov/notifications-admin/pull/952 but this
didn’t take pagination into account.

So if you visited page 2, the contents of the page would be replaced by
Javascript with the contents of page 1. So you’d never be able to see
anything beyond page 1, expect for a brief fraction of a second when the
page loaded.

This commit makes sure the AJAX request uses whatever page parameter is
in the URL of the original page.
2016-09-30 15:41:46 +01:00
Rebecca Law
2eb7360468 Merge pull request #959 from alphagov/remove-user-from-service
Allow platform admin to edit users.
2016-09-30 14:07:20 +01:00
Rebecca Law
5a50c945c7 Allow platform admin to edit users. 2016-09-30 11:48:16 +01:00
Chris Hill-Scott
f31170f5a2 Remove Google Analytics
Reverts https://github.com/alphagov/notifications-admin/pull/306

We’re not looking at the data from Analytics, so shouldn’t be collecting
it just in case.

<sup>Brought to you by the fun police.</sup>
2016-09-30 09:23:00 +01:00
Chris Hill-Scott
48891babc4 Add log of notifications to API integration page
Now that we’ve removed simulated notifications from the dashboard and
activity pages they’re not visible anywhere in the app.

While they should’t be visible to non-technical users, developers have
a real need for Notify to confirm that their code is doing what they
expect. This is needed especially when they’re just getting started with
Notify.

There’s no way of seeing this info from the API either, because a key
can only get notifications created with a key of that type.

It doesn’t make sense to make this a ‘mode’ of the dashboard or activity
because the information about notifications that developers need is
also different. So this commit adds up to 50 of the most recent
notifications sent via the API to the page that developers use as their
‘home’ page.

This also lets us explain the 7 days thing to developers via the
empty slate state of this area of the page.
2016-09-29 09:28:04 +01:00
Chris Hill-Scott
a04aad8825 Add additional params to get notifications client
We want to show a log of notifications that have been sent from the API.

The admin app uses its own private `/service/…/notifications` endpoint
for listing activity. This commit allows us to pass through two
optional, additional parameters to tell the API to:

- include or not include notifications created from a job
- include or not include notifications created with a test API key
2016-09-29 09:27:55 +01:00
Chris Hill-Scott
3e42042156 Add a page to manage a service’s whitelist
Services who are in alpha or building prototypes need a way of sending
to any email address or phone number without having to sign the MOU.

This commit adds a page where they can whitelist up to 5 email addresses
and 5 phone numbers.

It uses the ‘list entry’ UI pattern from the Digital Marketplace
frontend toolkit [1] [2] [3].

I had to do some modification:
- of the Javascript, to make it work with the GOV.UK Module pattern
- of the template to make it work with WTForms
- of the content security policy, because the list entry pattern uses
  Hogan[1], which needs to use `eval()` (this should be fine if we’re
  only allowing it for scripts that we serve)
- of our SASS lint config, to allow browser-targeting mixins to come
  after normal rules (so that they can override them)

This commit also adds a new form class to validate and populate the two
whitelists. The validation is fairly rudimentary at the moment, and
doesn’t highlight which item in the list has the error, but it’s
probably good enough.

The list can only be updated all-at-once, this is how it’s possible to
remove items from the list without having to make multiple `POST`
requests.

1. 434ad30791/toolkit/templates/forms/list-entry.html
2. 434ad30791/toolkit/scss/forms/_list-entry.scss
3. 434ad30791/toolkit/javascripts/list-entry.js
4. http://twitter.github.io/hogan.js/
2016-09-29 09:27:38 +01:00
Chris Hill-Scott
4a596c1dd2 Add a new banner for telling you about trial mode
We’ve found in research that developers have no idea they’re in trial
mode until they hit an error. And even then they don’t really know what
trial mode means.

So this commit:
- adds a message to the API integration page about trial mode
- puts it in a really yellow banner to draw attention to it
- adds the same banner to the settings page
2016-09-28 17:00:46 +01:00
Chris Hill-Scott
dfa3a9242f Add a separate page for linking to documentation
It’s going to get too cluttered to have these links on the API index
page.
2016-09-28 17:00:45 +01:00
Chris Hill-Scott
d9cc936972 Add an index page for the API integration
This commit adds a placeholder page which, for now, just has links to
the API keys page and links to the clients.

There’s more stuff to come on this page, but this commit just does the
reorganising so that it’s easier to review.
2016-09-28 17:00:45 +01:00
Martyn Inglis
0bf39c75d9 Fixed bug where there was an error when try and change email.
- it tried to send a verify code which no longer is applicable
- one stage of process removed and tests update properly

Flow is:

- Change email
- Confirm with password
- Done
2016-09-28 14:34:22 +01:00
Chris Hill-Scott
6a0bf88211 Merge pull request #950 from alphagov/8-char-password
Reduce minimum password length to 8 characters
2016-09-28 14:34:02 +01:00
Chris Hill-Scott
d9eac94f1e Make the activity page update with AJAX
The activity page looks the same as the job page. So it should behave
the same and not need manually refreshing to see the new stuff.
2016-09-27 15:34:47 +01:00
Chris Hill-Scott
d747389e2a Add variations on GOV.UK Notify to blacklist
There’s a chance that someone will run out of imagination and use
the name of the thing they’re signing up for as their password.

This wouldn’t be caught by the generic blacklist.
2016-09-27 12:24:46 +01:00
Chris Hill-Scott
68a6ceec78 Give better error message for blacklisted password
Telling the user what to do, rather than the mistake they’ve made is
usually better.
2016-09-27 11:51:12 +01:00
Chris Hill-Scott
136662bd30 Stop people using very common passwords
If a user chooses a very common password then an attacker could guess it
in relatively few attempts, circumventing the lockout.

CESG recommend blacklisting the most common passwords:

> …enforcing the requirement for complex character sets in passwords is
> not recommended. Instead, concentrate efforts on technical controls,
> especially:
>
> - defending against automated guessing attacks by either using account
>   lockout, throttling, or protective monitoring
> - blacklisting the most common password choices

How I made this list:

- went to the OWASP repository of security lists:
  https://github.com/danielmiessler/SecLists

- downloaded `10k_most_common.txt`, `twitter-banned.txt` and
  `500-worst-passwords.txt`

- filtered out any under 8 characters:
  ```
  sed -r '/^.{,7}$/d' passwords-twitter.txt > passwords-combined.txt
  sed -r '/^.{,7}$/d' passwords-500.txt >> passwords-combined.txt
  sed -r '/^.{,7}$/d' passwords.txt >> passwords-combined.txt
  ```

- filtered out any duplicates:
  ```
  cat passwords-combined.txt | awk '!x[$0]++' > passwords-combined-deduped.txt
  ```
2016-09-27 11:51:12 +01:00
Rebecca Law
4f20dceb9f Add email domains to whitelist for user registration. 2016-09-20 11:02:53 +01:00
Rebecca Law
ef792d9d2a Add a new domain for the email domain regex. 2016-09-15 09:39:44 +01:00
imdadahad
69c16cb0e4 Merge pull request #936 from alphagov/fix-forgot-password-empty-user-issue
Fix exception raised when a pending user attempts to complete 'forgotten password' flow
2016-09-13 15:39:29 +01:00
Chris Hill-Scott
6bad0101c8 Merge pull request #939 from alphagov/platform-admin-reorg
Reorganise list of services on platform admin page
2016-09-13 12:06:14 +01:00
Chris Hill-Scott
311ae4cfa4 Sort services by newest created first
Other than which services are live it’s also interesting to know what
services are getting created on Notify. So let’s put the newest ones at
the top of the page.
2016-09-13 10:38:33 +01:00
Chris Hill-Scott
88fff50ea3 Split platform admin page into live and trial mode
It sucks having to scroll down the massive list of services just to see
which ones are live.
2016-09-13 10:38:33 +01:00
Chris Hill-Scott
2d7ed4d34f Fix overlapping text on tables of notifications
This commit changes the tables of notifications from 3 columns to two
columns. This is so the text has more room, so it doesn’t start
overlapping.

It also makes sure that if the recipient gets really long that it will
be cut off with an ellipsis, rather than overlapping…

I hypothesize that if a notification fails you probably don’t care when
it failed, just that it failed.
2016-09-13 10:37:38 +01:00
Leo Hemsted
62868bc014 add test for id appearing in notification table
use new pytest yield fixture
2016-09-09 16:30:07 +01:00
Imdad Ahad
9eab8a726f - Add test to check that two-factor auth activates a user as expected
- Ensure DB user activation statusupdate only executed when required
- Fix test_should_activate_user_after_verify
2016-09-09 15:22:56 +01:00
Chris Hill-Scott
6f1fa62714 Merge pull request #927 from alphagov/quis-patch-1
Reword resend email page
2016-09-07 15:25:33 +01:00
Chris Hill-Scott
9cf3854ac6 Merge pull request #929 from alphagov/fix-trial-mode-500
Fix 500 on trial mode page
2016-09-07 15:01:49 +01:00
imdadahad
be60e74a21 Merge pull request #926 from alphagov/add-redirect-for-email-verification
Redirect and resend verification email when pending user attempts to login
2016-09-07 14:23:56 +01:00
Chris Hill-Scott
743377f6b7 Fix 500 on trial mode page
I was using the trial mode page to prototype the time picker as part of
225a61ddd3.

I didn’t clean up properly, and left an errant undefined variable, which
caused the trial mode page to `500`.

This commit:
- removes the errant argument
- adds a test for all the static pages to make sure that they at least
  return a `200`
2016-09-07 10:49:57 +01:00
Chris Hill-Scott
897b89ba6e Make missed content changes on password sent page
Lose the ‘now‘ like in: https://github.com/alphagov/notifications-admin/pull/877

Lose the ‘we‘ like in: https://github.com/alphagov/notifications-admin/pull/884
2016-09-06 17:22:27 +01:00
Chris Hill-Scott
93ca29eab8 Merge pull request #922 from alphagov/cancelled-jobs
Let users cancel a job
2016-09-06 17:12:19 +01:00
Chris Hill-Scott
9865c2916f Reword resend email page
Changes the wording to match: 166870c536/app/templates/views/registration-continue.html (L10)

We don’t use ‘we‘.

The ‘in order to‘ bit is unnecessarily verbose.
2016-09-06 16:59:26 +01:00
Chris Hill-Scott
eb11615a32 Add a cancel job button
If you schedule a job you might change your mind or circumstances might
change. So you need to be able to cancel it. This commit adds a button
on the job page which hits the `…/cancel` API endpoint for a job.
2016-09-06 16:55:24 +01:00
Imdad Ahad
91c878a80e Remove flash banner as unncessary 2016-09-06 16:53:53 +01:00
Imdad Ahad
998d33e283 Redirect and resend verification email when pending user attempts to login 2016-09-06 15:44:33 +01:00
Chris Hill-Scott
166870c536 Merge pull request #924 from alphagov/fix-trial-mode-message
Fix bug where every service was ‘in’ trial mode
2016-09-06 13:51:14 +01:00
Chris Hill-Scott
ffdd20351e Fix bug where every service was ‘in’ trial mode
The message on the service settings page was being shown for every
service, whether or not they were in trial mode. It also tests for both
cases.
2016-09-05 15:08:18 +01:00
Martyn Inglis
2f56643e3a Fix up issues caused by merge
- statistics now on job_json
- removed test that validates we handle the case where job has no statistics key - never happens
2016-09-05 14:45:34 +01:00
Martyn Inglis
1ad2665bfe Merge branch 'master' into remove-code-that-handled-old-new-job-api
Conflicts:
	app/main/views/jobs.py
	app/notify_client/job_api_client.py
2016-09-05 14:29:58 +01:00
Martyn Inglis
1732415b45 Fixed formatting issues 2016-09-05 13:38:47 +01:00
Chris Hill-Scott
c94675f457 Don’t show cancelled jobs anywhere
The information about a job doesn’t make sense if a job is cancelled.

We could change the information to reflect that the job won’t be sent/
wasn’t sent/was cancelled, but there’s nothing you can really do with
this info.

So instead let’s:
- hide cancelled jobs from the dashboard
- hide cancelled jobs from the jobs page
- 404 the page if the user tries to click back enough times to hit the
  job page
2016-09-02 12:44:36 +01:00
Chris Hill-Scott
be90cf2783 Make sure create job client can handle statistics
The create job endpoint returns the data about the job with a `data:`
wrapper. This commit makes sure that, when the client is trying to
process a job which has just been created, it looks inside the `data`
wrapper.
2016-09-01 13:43:15 +01:00
Chris Hill-Scott
6921d8b59e Sort scheduled jobs so soonest is first
The scheduled job you probably care about the most is the soonest –
irrespective of when you scheduled it.
2016-08-31 16:59:24 +01:00
Chris Hill-Scott
661f5ba702 Don’t allow test messages to be scheduled
For two reasons:
- it’s extra stuff in tour that users dont yet need to know about
- test messages are hidden from the dashboard, so you’d have no
  visibility of when they were sending once you’d scheduled them
2016-08-31 16:59:04 +01:00