Commit Graph

7170 Commits

Author SHA1 Message Date
Leo Hemsted
fcefd2a80c pass in data to posts 2017-11-09 15:02:59 +00:00
Leo Hemsted
2f37b00989 use active-endpoint 2017-11-09 14:58:44 +00:00
Leo Hemsted
cbf1b3ec38 replace user PUT with POSTs
the update_user fn was used in two places, for things that are handled
fine by update_user_attribute. Reduce complexity in the API by killing
the PUT, which is more dangerous (might silently overwrite things that
shouldn't be, like "last_logged_in_at" etc).

Had to change the code not received mobile number form, and the
activate user function.
2017-11-09 14:58:33 +00:00
Leo Hemsted
76b9cb8f81 Merge pull request #1631 from alphagov/revert-1627-remove-user-put
Revert "replace user PUT with POSTs"
2017-11-09 14:57:15 +00:00
Leo Hemsted
bfa6980913 Revert "replace user PUT with POSTs" 2017-11-09 14:57:01 +00:00
Leo Hemsted
395a2fccbb Merge pull request #1630 from alphagov/revert-1629-activate-endpoint
Revert "use new activate endpoint"
2017-11-09 14:55:20 +00:00
Leo Hemsted
b9eca67b0d Revert "use new activate endpoint" 2017-11-09 14:55:08 +00:00
Leo Hemsted
51e91bc627 Merge pull request #1629 from alphagov/activate-endpoint
use new activate endpoint
2017-11-09 14:54:04 +00:00
Leo Hemsted
7b0fcf8c08 use active-endpoint 2017-11-09 14:37:33 +00:00
Leo Hemsted
a2926eaffe Merge pull request #1627 from alphagov/remove-user-put
replace user PUT with POSTs
2017-11-09 14:07:07 +00:00
Rebecca Law
8c9d90c0f8 Remove unused routes 2017-11-09 13:48:27 +00:00
venusbb
1ab4681ff5 Use the revise api endpoints without current-year parameter 2017-11-09 13:18:09 +00:00
Leo Hemsted
302a024d3b replace user PUT with POSTs
the update_user fn was used in two places, for things that are handled
fine by update_user_attribute. Reduce complexity in the API by killing
the PUT, which is more dangerous (might silently overwrite things that
shouldn't be, like "last_logged_in_at" etc).

Had to change the code not received mobile number form, and the
activate user function.
2017-11-09 12:30:12 +00:00
Chris Hill-Scott
86abb7dba9 Refactor for number reuse 2017-11-09 10:56:54 +00:00
venusbb
66b49821a7 Merge branch 'master' of https://github.com/alphagov/notifications-admin into vb-free-sms-history 2017-11-09 09:24:49 +00:00
Chris Hill-Scott
a11e57c50a Merge pull request #1625 from alphagov/revert-1614-fix-escaped-characters-inbound
Revert "Stop escaping special characters in inbound messages"
2017-11-07 17:27:02 +00:00
Chris Hill-Scott
6325f26081 Revert "Stop escaping special characters in inbound messages" 2017-11-07 17:22:57 +00:00
Chris Hill-Scott
a988abefee Merge pull request #1613 from alphagov/pyup-update-notifications-python-client-4.5.0-to-4.6.0
Update notifications-python-client to 4.6.0
2017-11-07 17:13:45 +00:00
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
eb0ce31253 Merge pull request #1623 from alphagov/103-104-and-44-45
103 - 104 and 44 - 45 orgs for DBS
2017-11-07 17:04:56 +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
0535702707 ensure flask app has right name 2017-11-07 11:23:15 +00:00
Pete Herlihy
43b487c823 Merge pull request #1616 from alphagov/102-103
102 - 103 for FormFinder Admin MOJ
2017-11-06 20:37:20 +00:00
Alexey Bezhan
7ed1156fc7 Merge pull request #1618 from alphagov/add-jshintrc
Move jshint configuration to .jshintrc
2017-11-06 17:46:34 +00:00
Alexey Bezhan
fce80b87b7 Move jshint configuration to .jshintrc
When provided with inline configuration in a gulp task jshint will
still try to load a configuration file from the current directory
or the user's home directory. If user has a global .jshintrc file
that sets different linting options this could lead to `npm test`
output being different from the CI one.

jshint only uses the first file it finds, and .jshintrc in current
directory or any parent of the current directory takes precedence
over the user one, so moving jshint configuration from gulpfile to
.jshintrc should make `npm test` produce the same outcome regardless
of the user config.
2017-11-06 17:37:15 +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
ba2c5a6ee2 Merge pull request #1615 from alphagov/pyup-update-pyexcel-xlsx-0.5.2-to-0.5.4
Update pyexcel-xlsx to 0.5.4
2017-11-06 15:49:14 +00:00
pyup-bot
3c9ef52ffb Update pyexcel-xlsx from 0.5.2 to 0.5.4 2017-11-06 15:45:20 +00:00
Chris Hill-Scott
095845109f Merge pull request #1610 from alphagov/allow-updates-to-sms-prefixing
Allow updates to SMS prefixing setting
2017-11-06 15:43:20 +00:00
Chris Hill-Scott
9e52958fab Merge pull request #1607 from alphagov/pyup-update-pyexcel-xls-0.5.2-to-0.5.4
Update pyexcel-xls to 0.5.4
2017-11-06 15:43:08 +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
pyup-bot
0071e37e61 Update notifications-python-client from 4.5.0 to 4.6.0 2017-11-06 11:47:51 +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 Waszczuk
db8f7032fe Merge pull request #1612 from alphagov/fix-analytics-csp
Stop content security policy blocking GA
2017-11-06 10:45:51 +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
240f25eaf9 Fix failing tests 2017-11-03 16:15:39 +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
55093691f1 Updated test to reflect new label on callback URL field 2017-11-03 16:05:10 +00:00
Pete Herlihy
431e269cf9 Updated the field label for the callback URL 2017-11-03 16:02:43 +00:00