Commit Graph
9239 Commits
Author SHA1 Message Date
Chris Hill-Scott 279c76eb18 Merge pull request #1614 from alphagov/fix-escaped-characters-inbound
Stop escaping special characters in inbound messages
2017-11-07 17:12:07 +00:00
Chris Hill-Scott dbd4372ca3 Merge pull request #1624 from alphagov/cesg---ncsc
Updated the domain for CHECK link from cesg to ncsc
2017-11-07 17:11:39 +00:00
Pete Herlihy 83d8e3d99b Updated the domain for CHECK link from cesg to ncsc 2017-11-07 17:02:22 +00:00
Pete Herlihy 75bca28cc1 103 - 104 and 44 - 45 orgs for DBS 2017-11-07 16:36:05 +00:00
Leo Hemsted 2cd77e628e remove wsgi.py - always serve with whitenoise
We're now running our app as a wsgi app locally, so don't need to
distinguish between the two processes by having wsgi and application.py
whitenoise just serves static files nicely - we don't lose anything
by doing that locally.
2017-11-07 11:50:13 +00:00
Leo Hemsted 4aeb57567a remove flask-script
flask-script has been deprecated by the internal flask.cli module, but
making this carries a few changes with it

* you should add FLASK_APP=application.py and FLASK_DEBUG=1 to your
  environment.sh.
* instead of using `python app.py runserver`, now you must run
  `flask run -p 6012`. The -p command is important - the port must be
  set before the config is loaded, so that it can live reload nicely.
  (https://github.com/pallets/flask/issues/2113#issuecomment-268014481)
* find available commands by just running `flask`.
* run them using flask. eg `flask list_routes`
* define new tasks by giving them the decorator
  `@app.cli.command('task-name')`. Task name isn't needed if it's just
  the same as the function name. Alternatively, if app isn't available
  in the current scope, you can invoke the decorator directly, as seen
  in app/commands.py
2017-11-06 17:33:04 +00:00
Pete Herlihy 430c67e538 102 - 103 for FormFinder Admin MOJ 2017-11-06 16:34:34 +00:00
Chris Hill-Scott 9e600b6051 POST to the correct endpoint when updating
`prefix_sms_with_service_name` is a computed attribute on the service
model. It’s where we get the value from, and the API does some work to
get it from the database, or derive it from the default SMS sender.
It can’t be updated, because it’s not itself a database column.

`prefix_sms` is the name of the actual database column. This is the
thing that we need to update.

This will go away eventually.
2017-11-06 15:08:34 +00:00
Chris Hill-Scott 31497945c0 Change wording based on Thom’s feedback 2017-11-06 14:12:25 +00:00
Chris Hill-Scott f329e138cd Factor out string escaping code
So that it only lives in one place.
2017-11-06 13:24:16 +00:00
Chris Hill-Scott f6950ae987 Stop escaping special characters in inbound
At least one of our providers gives us messages with special characters
escaped, ie a newline comes through as `\n`, not a literal newline. We
shouldn’t be showing these backslashes to any of our users.

Python has built in codecs for dealing with encoding/decoding of
strings – see
https://docs.python.org/3/library/codecs.html#text-encodings
for details. Using these builtins is safer than trying to do anything
regex or parsing-based.
2017-11-06 13:24:16 +00:00
Chris Hill-Scott fed4275403 Factor out code that gets message content
The nesting is getting pretty deep here. Let’s make it into its own
method so it doesn’t get out of hand when we add more functionality to
it.
2017-11-06 13:10:02 +00:00
Chris Hill-Scott 6d3855bba4 Allow updates to SMS prefixing setting
We’re extracting this from being determined based on what the sender
name is to its own setting.

This commit will let users set it independently.

Until the explicitly set it, it will still be determined based on
whether their default sender name matches the default for the platform.
2017-11-06 11:24:46 +00:00
Chris Hill-Scott 1d10ad2247 Stop content security policy blocking GA
In https://github.com/alphagov/notifications-admin/pull/1583 we changed
our Google Analytics settings to use newer browsers’ `sendBeacon`
feature. The advantage of this is that it

> [ensures] that the data has been sent during the unloading of a
> document [which] is something that has traditionally been difficult
> for developers

– https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon

To transmit this data it uses a AJAX request (`XMLHttpRequest`)
underneath. AJAX requests are governed by the `connect-src` content
security policy (or the `default-src` if one is not present).
`connect-src`:

> Applies to XMLHttpRequest (AJAX), WebSocket or EventSource. If not
> allowed the browser emulates a 400 HTTP status code.

– https://content-security-policy.com/

Because we didn’t have one in place, `sendBeacon` requests to GA were
getting blocked in browsers that support content security policy (pretty
much everything better than IE11[1]).

1. https://caniuse.com/#feat=beacon
2017-11-06 10:25:30 +00:00
Chris Waszczuk 98c8ddca38 Merge pull request #1598 from gov-cjwaszczuk/master
Email auth for inviting members and editing permissions
2017-11-06 10:00:15 +00:00
Pete Herlihy 8985f3978e Merge pull request #1611 from alphagov/inbound-callback
Inbound callback page
2017-11-03 16:22:48 +00:00
Chris Hill-Scott c19855c0b0 Fix missing import 2017-11-03 16:12:37 +00:00
Pete Herlihy 60a39b2e49 Updated the callbacks page to add the link to new documentation. 2017-11-03 16:10:26 +00:00
Pete Herlihy 431e269cf9 Updated the field label for the callback URL 2017-11-03 16:02:43 +00:00
Pete Herlihy 4b2ba34d68 Updated the label to set the callback URL on the settings page 2017-11-03 14:25:31 +00:00
Pete Herlihy bc7af49b56 New page explaining the format of callback messages 2017-11-03 14:24:10 +00:00
Chris Hill-Scott c0f1de2342 Merge pull request #1596 from alphagov/extra-letter-spacing-phone-search
Add extra letter spacing to phone number search
2017-11-03 14:20:21 +00:00
Chris Hill-Scott 2ed46b6458 Merge pull request #1606 from tuzz/fix-a-typo
Fix a typo: generates -> generate
2017-11-03 14:20:15 +00:00
Chris Hill-Scott ba128d05bc Use service setting to determine prefixing of SMSs
Rather than doing this nasty `if` statement, let the API work out what
to do. Also means that the logic is not repeated between the two apps.
2017-11-03 13:14:10 +00:00
Pete Herlihy 2c74027e0d Adding a route for 'callbacks' page
Gone with callbacks as this page may be extended for delivery receipts in the future.
2017-11-03 11:56:15 +00:00
Rebecca Law fa6e4971c9 Merge pull request #1603 from alphagov/sms-sender-for-one-off
Select text message sender for one off notifications
2017-11-02 16:35:51 +00:00
Rebecca Law edf0e0ec13 Merge pull request #1604 from alphagov/fix-format-on-trial-service
Fix some formatting on the trial mode services page
2017-11-02 16:28:04 +00:00
Rebecca Law ff22c83b1d Added a hint to show default and receives text messages 2017-11-02 15:48:19 +00:00
Rebecca Law 83bfc50884 Added a hint for Receives replies 2017-11-02 14:58:14 +00:00
Chris Patuzzo 5152fa8e82 Fix a typo: generates -> generate 2017-11-02 13:51:00 +00:00
Leo Hemsted 04adb15e85 make sure old invites get the proper message
we were accidentally covering up the expiry message with a more
generic one
2017-11-02 13:49:24 +00:00
Rebecca Law 3f1c543735 Fix some formatting on the trial mode services page 2017-11-02 13:39:37 +00:00
chrisw c6ea90a7d8 Email auth for inviting members and editing permissions 2017-11-02 12:38:01 +00:00
Rebecca Law 2ea921952f This PR adds the ability to select a text message sender if more than one exist for the service. 2017-11-02 12:07:46 +00:00
Rebecca Law 5e175954d2 Merge pull request #1600 from alphagov/add-letters-to-platform-admin
Add letter counts to the platform admin page.
2017-11-02 10:16:02 +00:00
Leo Hemsted 80b5af6ed9 Merge branch 'master' into load-service-err 2017-11-01 16:43:51 +00:00
Leo Hemsted 6742560b33 Merge pull request #1599 from alphagov/new-acc-email-validation
New account verification emails no longer call API
2017-11-01 16:43:04 +00:00
Rebecca Law 4acfd4101f Add letter counts to the platform admin page.
The big number counts are based on how many messages have been delivered. For letters we are using the requested count.
2017-11-01 16:33:06 +00:00
Leo Hemsted 9eb5e6a532 make sure invite tokens still check token on admin for error handler to kick in 2017-11-01 16:17:04 +00:00
Leo Hemsted 19f731ec07 add error handler that catches invalid tokens, and returns 404 2017-11-01 15:47:05 +00:00
Leo Hemsted aff9d47323 don't hit API when checking new account email-token
we currently store new account email verify tokens in the database, and
check against that to work out if they've expired. But we don't need to
do that, tokens have their own timing mechanism. So lets just use that,
and free up the database to do other things.

Also, standardised the forgot password, change email, and new account
email verification timeouts to all be an hour, from the config val
'EMAIL_EXPIRY_SECONDS'
2017-11-01 15:32:24 +00:00
Pete Herlihy fafb8dc75b 100-102 for GOV.UK Email and SSCSA 2017-11-01 14:50:15 +00:00
Chris Hill-Scott 57ca2b48ee Add extra letter spacing to phone number search
This is another place where you might be transcribing a phone number and
having it spaced out will make it easier for you to spot errors.
2017-10-31 17:54:22 +00:00
Pete Herlihy 061ef3dddc 98 to 100 services..... woo hoo....
Also corrected the org count to 44 as HM Passports Office isn't a separate org from Home Office.
2017-10-31 12:27:34 +00:00
venusbb 8e6c284d7b add logic to change future free_sms_fragment_limit items when service setting changed 2017-10-31 11:56:51 +00:00
venusbb 8ea38ba7b6 Use annual_billing tables at backend for getting and updating free_sms_fragment_limit 2017-10-31 11:22:57 +00:00
Leo Hemsted 273b864dce add auth_type default to InvitedUser object
we unpack the api invited user rest endpoint results straight into the
InvitedUser object, so we should make sure that any fields added to
the api response are mentioned here
2017-10-30 17:38:50 +00:00
Leo Hemsted 3128b5424d make sure load_service_before_request handles 404s
if it 404s, because the service id doesn't exist, then it should die
gracefully (showing a 404 error page), rather than what it currently
does, which is die kicking and screaming with a 500
2017-10-30 16:59:24 +00:00
chrisw d02cd67b0d Fixed broken edit functionality 2017-10-30 15:31:35 +00:00
chrisw 4e721c95ce Added Multiple SMS sender functionality 2017-10-30 13:40:34 +00:00