Commit Graph

2056 Commits

Author SHA1 Message Date
Katie Smith
309396c906 Make email addresses case insensitive when inviting users to services
Email addresses in invites should be case insensitive. This is to stop
the bug where a user creates their account using a lower case email
address (e.g. user1@gov.uk), but is then invited to a service using
their email address in a different case (e.g. USER1.gov.uk) and sees
an error message telling them that they can't accept an invite for a
different email address.
2018-01-02 09:26:49 +00:00
Rebecca Law
259db9c271 Put the download csv link on the activity page.
Still needs some tests, probably some refactoring as well.
2017-12-30 16:54:39 +00:00
Rebecca Law
ff01759cce Merge branch 'master' into letter-on-usage-page 2017-12-21 14:24:40 +00:00
Rebecca Law
e7f94bd007 Add a template to show letter usage if the service has the letter permission 2017-12-20 16:28:40 +00:00
Chris Hill-Scott
5f5dd3ac41 Rewrite check for row existence as conditional
Because exceptions can be expensive performance wise (see:
https://docs.python.org/3/faq/design.html#how-fast-are-exceptions).

Since we’re counting the number of rows anyway this doesn’t introduce
any performance overhead there. And I think it’s equally readable/same
number of lines of code.
2017-12-20 11:48:30 +00:00
Chris Hill-Scott
c3e2bce98b Add URLs for previewing all rows of a spreadsheet
We’ve heard from some users, especially those sending letters, that
they’d like to check that a spreadsheet they’ve uploaded has populated
the template correctly.

My reckon is that seeing just one row of the spreadsheet populate the
template isn’t enough to give people confidence that everything’s
working properly. So this commit is the first step towards being able
to preview an arbitrary row of a template, by extending the URL
structure to optionally accept a row number for pages or files (ie PNG)
that preview successfully uploaded spreadsheets.

What this commit doesn’t do is link to these pages; that will come as
part of a subsequent commit.
2017-12-20 11:15:38 +00:00
Chris Hill-Scott
587e18d2ef Lookup index, rather than iterating
Since instances of `Recipients` are now iterable we can just look up the
first row by index, rather than having to hit the rows property as a
generator.

There is a chance that there won’t be a first row, if the file has 1 or
fewer columns. So we still need to handle a possible exception (albeit
it a different one to before).
2017-12-20 11:15:37 +00:00
Chris Hill-Scott
5bac021493 Remove unused variable
This variable isn’t used by our Jinja templates. Presumably it was
from the time before instances of `Template` were responsible for
showing who the email/text message was being sent to.
2017-12-20 11:15:36 +00:00
Rebecca Law
b7db7debc5 Add letters to usage page.
Before this goes live need to only show letters on usage if the service has the permission.
2017-12-19 14:35:10 +00:00
Rebecca Law
43747bd1ea Add letter usage to usage page.
Still need to add the summary info.
2017-12-15 17:28:52 +00:00
Chris Hill-Scott
a8829cd154 Make whitespace stripping work for whitelists too
It’s a bit hacky, but it fixes a potential issue for users.

Code adapted from:
2c34f678ab
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
d0d230f119 Remove existing whitespace stripping code
Since we’re doing this globally, we don’t need to handle it in a custom
way for the sign in form (and it’s much nicer encapsulated like this).

Also added some more extensive tests in this commit.
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
70badae575 Strip whitespace before validating any form
We’ve had whitespace-in-emails problems on:
- register form
- sign in form
- send one off form

We should just handle whitespace gracefully, by ignoring it. Makes sense
to do this at a global level because there might be other places it’s
causing problems that we don’t know about.

The only place that users _might_ be relying on leading/trailing spaces
(and we have no way of knowing this) is in passwords or tokens. So this
filter ignores any instances of `PasswordField`.

Adapted from @pcraig3’s work on Digital Marketplace:
- 4b06f5cfb7
- e761c1ce65
2017-12-14 11:06:55 +00:00
Chris Hill-Scott
3f01da05c7 Fix order of callbacks
Delivery comes before inbound. The order of the URLs was jumbled in two
places:
- in the view function
- in the Jinja template

So as the user saw it the URLs were in the right order, because the
double jumbling cancelled itself out. But it made the code _really_
confusing to read.
2017-12-13 11:58:21 +00:00
Katie Smith
87f5a9e124 Fix bug when editing letter contact block from letter template page
When viewing a letter template, there is a button to edit the letter
contact block. This should take the user to the page to edit the letter
contact block, but if a service has not set any letter contact blocks, the
button was returning a 404 error.

The code has now been changed so that if the service has no letter contact
blocks the edit button will link to the page to add a letter contact
block.

Pivotal story: https://www.pivotaltracker.com/story/show/152881444
2017-12-12 16:38:07 +00:00
venusbb
6f0ce3b33d rewrite one of the obsolete test 2017-12-11 17:17:40 +00:00
venusbb
3377efb267 Merge branch 'master' of https://github.com/alphagov/notifications-admin into vb-callback-admin
Some content change
Refractor api_integration to api_keys to reduce git difference.
2017-12-11 13:43:29 +00:00
venusbb
deda4e1d57 Merged 2017-12-11 11:44:29 +00:00
venusbb
482309af3b fixed empty callback dict problem 2017-12-11 11:40:38 +00:00
chrisw
9c0d2c2a39 refactor of api callbacks admin work 2017-12-11 11:37:33 +00:00
chrisw
df383b5c0f renamed api_keys file 2017-12-11 11:37:26 +00:00
chrisw
76117c148c Allow service to set callback url for notifications 2017-12-11 11:37:26 +00:00
Chris Hill-Scott
eef66b70de Reword because ‘inbetween’ isn’t a word 2017-12-11 11:19:33 +00:00
Chris Hill-Scott
242a216c1b Update error message about commas in placeholders
We call the yellow things ‘double brackets’ on the frontend, not fields
or placeholders. This error message was a bit out of date.

Also refactored it to use the `Field` class; this code was probably
written before `Field` was factored out of `Template`.
2017-12-11 11:19:33 +00:00
Chris Hill-Scott
bef8e8887b Strip spaces from email addresses when signing in
If you copy and paste an email address into the sign in box, there’s a
chance you’ll also copy some leading or trailing spaces. This is
especially likely to happen if you’re doing this while using your
computer upside down.

If this happens, it never even gets as far as looking up the user,
because the form validation doesn’t consider a string with a leading
space to be a valid email address.

This commit makes sure that accidental spaces are handled, by removing
them before doing any validation or hitting the API to look up the user.
2017-12-08 16:17:45 +00:00
chrisw
71c9618a26 refactor of api callbacks admin work 2017-12-08 10:53:02 +00:00
chrisw
719dad375a renamed api_keys file 2017-12-08 10:52:50 +00:00
chrisw
43c14fb756 Allow service to set callback url for notifications 2017-12-08 10:52:50 +00:00
Leo Hemsted
eb3d4acb45 update free sms fragment limit to go via billing client instead of service 2017-12-04 16:03:11 +00:00
Ken Tsang
8fb7f79e5e Add send letters as PDF service setting 2017-12-01 19:12:22 +00:00
Chris Hill-Scott
b6096dbe06 Remove performance link from features nav
The features nav is supposed to navigate your between pages in the app.
It’s very unexpected to have it open an external link.

Performance isn’t strictly a part of Support, but it’s worked having it
there for long enough that it’s probably not a bother.
2017-12-01 10:16:40 +00:00
Chris Hill-Scott
4b77ef0533 Merge pull request #1667 from alphagov/email-auth-pword-reset
ensure that email auth users don't get 2fa codes when resetting passwords
2017-11-30 15:50:24 +00:00
Chris Hill-Scott
87b58afdb0 Merge pull request #1671 from alphagov/auth-type-by-request
Invite users to choose how team members sign in
2017-11-30 15:49:47 +00:00
Chris Hill-Scott
ba1c98ed49 Invite users to choose how team members sign in
Email auth is a new feature that currently we’ve only given to teams
who have contact us with a problem.

At the moment, we’re aware of all the teams that are sharing phone
numbers when they sign in. We think that in the future there will be
other teams who encounter this problem. So we should let them know that
they should contact us if they are having the problem.

At the moment we want to talk to teams before giving them access to the
feature, so that we’re confident it’s only going to teams from whom it’s
more secure than using a text message code.
2017-11-30 15:32:12 +00:00
chrisw
2c884a0246 Refactored redirects into seperate method 2017-11-29 13:59:01 +00:00
chrisw
90e18e04ee Updated support views to represent new url structure 2017-11-29 13:58:12 +00:00
Leo Hemsted
f7e2a12aba ensure that email auth users dont get 2fa codes when resetting passwords 2017-11-28 15:25:29 +00:00
chrisw
6b98e62f4c Updated support logic to represent new urls structure 2017-11-28 11:59:11 +00:00
chrisw
ed33e03d82 Adjusted and added static page views logic 2017-11-28 11:56:30 +00:00
Richard Chapman
629593291c Used url_for and redirect
- url_for instead of constructing the url manually
- Used redirect instead of RequestRedirect to be more consistent with
other code
2017-11-24 16:34:45 +00:00
Richard Chapman
155e432aa6 Disabled the template_history endpoint
- Updated tests and added a new mock_get_monthly_template_usage
- Deleted get_monthly_template_statistics_for_service
- Added new test to test the redirection of the old endpoint
2017-11-24 15:20:40 +00:00
Richard Chapman
1681b17fab Disabled the template_history endpoint
- Removed the code for the template_history endpoint and replaced with a
redirect to the new page so that anyone is forwarded on
- Updated the template to point to the new template_usage page
2017-11-24 14:36:36 +00:00
Richard Chapman
9dbb14c9e1 Refactored to be more pythonic
Removed the nested for loops and refactored to be pythonic so it is more
maintainable in future.
2017-11-22 15:50:31 +00:00
Richard Chapman
dd2bd2f80a Removed import
An import was not required so removed it.
2017-11-22 14:38:47 +00:00
Richard Chapman
f97fa2cebc Reused the months array instead of redefining it
Re-organised the code to re-use the months array which also was not
displaying a month where there was no stats. This now gets the months,
enumerates that array updating the templates used when there are stats
items so the users sees each month of the financial year (even if there
are no stats) when there are stats they are displayed.
2017-11-22 10:37:53 +00:00
Richard Chapman
5937842ca4 Fixes to the template usage page
- When a year contains no data ensure a default set of months is
returned so that all months can be seen in the UI
- Add the template id so the user can click through to the template
2017-11-21 16:48:37 +00:00
Richard Chapman
0d36a0ef16 Updated link to for browsing to financial years
The link which when clicked allows the user to view different financial
years was pointing to the template_activity page. Updated to the link
to point to the new page.
2017-11-21 11:09:35 +00:00
Chris Hill-Scott
5f40eabdf3 Improve page titles later on in the one off flow
Now that the page title for picking a sender/reply to has been improved,
I think these pages are also less clear than they could be.

This commit changes the page titles to (I hope) be clearer about what is
needed from the user on these pages.
2017-11-20 16:54:07 +00:00
Chris Hill-Scott
ecd43cee5e Fix misleading <h1> in one-off flow
Changing the `<h1>` in https://github.com/alphagov/notifications-admin/pull/1638
turned out to be quite confusing. The combination of the word
"recipient" and a selection of email addresses on the page was confusing.

This commit changes the page title to be much more explicit about what
is expected from the page, rather than what is consistent with the text
of the link that the user clicked.
2017-11-20 16:53:00 +00:00
Chris Hill-Scott
4105b6ff55 Fix misleading <h1> in one-off flow
Changing the `<h1>` in https://github.com/alphagov/notifications-admin/pull/1638
turned out to be quite confusing. The combination of the word
"recipient" and a selection of email addresses on the page was confusing.

This commit changes the page title to be much more explicit about what
is expected from the page, rather than what is consistent with the text
of the link that the user clicked.
2017-11-20 16:50:33 +00:00