Commit Graph

265 Commits

Author SHA1 Message Date
Ken Tsang
53e78c2b60 Update page to handle international stats 2017-04-28 14:49:41 +01:00
Leo Hemsted
cf125d0a14 add sent as a new status
functions as delivered - shows up in delievered column, contributes
to delivered stats etc.
2017-04-27 16:17:10 +01:00
kentsanggds
e37ce051e7 Merge pull request #1240 from alphagov/add-international-sms-feature-flag
Add international sms feature flag
2017-04-25 19:09:07 +01:00
Chris Hill-Scott
f3e69a808e Fix setting and display of letter branding
API and Admin were not using the same name for the organisation ID that
we have set with DVLA.
2017-04-24 14:46:19 +01:00
Ken Tsang
b1706fd213 Updated service settings for international sms 2017-04-24 13:52:10 +01:00
Chris Hill-Scott
eb9214978e Merge pull request #1234 from alphagov/letter-branding
Add platform admin setting for letter branding
2017-04-24 10:33:39 +01:00
Chris Hill-Scott
75f5829c1e Get organisations list from API rather than config
Hard coding the organisations means this information is duplicated
between the admin and the API, and could get out of sync.
2017-04-24 10:25:37 +01:00
Chris Hill-Scott
61470391bf Add platform admin setting for letter branding
Does two main things:
- defines what ‘brands’ we support, in terms of the ID that DVLA use
- adds a form to choose which branding a service uses (currently
  platform admin only, like email branding)

By doing this we will be able to (with some more work) preview and send
letters with a variety of different branding.

Story: https://www.pivotaltracker.com/story/show/143506905
2017-04-24 10:25:36 +01:00
Imdad Ahad
99805fb592 Add extra flag to indicate we want a csv notification response 2017-04-20 15:18:47 +01:00
Ken Tsang
e5a377edd8 Add letter jobs page, client and test 2017-04-11 10:59:50 +01:00
Leo Hemsted
2bb0cba430 add new letter job statuses to job api client
add test to test_dashboard to confirm we're getting for the right queus
2017-04-07 11:08:40 +01:00
Chris Hill-Scott
4a226a7a29 Show template usage broken down by month
This follows on from:
- https://github.com/alphagov/notifications-admin/pull/1094
- https://github.com/alphagov/notifications-admin/pull/1109

It depends on:
- [ ] https://github.com/alphagov/notifications-api/pull/829

A year is too long. Month-by-month is a better timeframe for making
decisions or seeing patterns in your usage.
2017-03-16 14:04:37 +00:00
Chris Hill-Scott
4e0ef92415 🖨
f5166bec79/app/notify_client/service_api_client.py (L143)
2017-03-14 13:03:03 +00:00
Imdad Ahad
276a072a54 Add logging for streaming contents 2017-03-13 14:53:19 +00:00
imdadahad
2391410435 Merge pull request #1170 from alphagov/feat-add-who-updated-providers
Show who updated providers and provider history data
2017-03-08 16:43:07 +00:00
Chris Hill-Scott
f54689a2b7 Merge pull request #1168 from alphagov/contact-letter-block
add letter_contact_block edit fields
2017-03-06 11:11:54 +00:00
Leo Hemsted
1cacd92411 Merge pull request #1153 from alphagov/forget-me
Remove remember me cookie
2017-03-06 09:39:52 +00:00
Leo Hemsted
5c3588445e add letter_contact_block edit fields
no actual template functionality yet - just the ability for services
that have letters enabled to edit a 10 line block that will go on the
top right hand side of their letters with contact information
2017-03-03 16:18:59 +00:00
Imdad Ahad
faf35a814d Add provider client method to get provider version history 2017-03-02 22:50:01 +00:00
Rebecca Law
35f61125e8 Fix the user flow when the user account is locked.
The user has 10 tries at the password, after which the account is locked.
The same is true for the verify code, the user will have 10 tries before the user account is locked.
2017-02-28 14:41:31 +00:00
Rebecca Law
2d4e0a0631 Added a reset of failed_login_count when the user is activated.
Update user from the update-password api call (which resets the failed_login_count)
2017-02-28 11:56:40 +00:00
Leo Hemsted
9fda5d1847 remove remember_me cookie and related code 2017-02-27 15:18:18 +00:00
Leo Hemsted
4df12f5f4e ensure other 2FA pages also handle session id
specifically, the 2FA page when you first create an account is different to the login 2FA page
and also the 2FA page when you change your phone number is different as well
2017-02-24 16:32:59 +00:00
Leo Hemsted
5aeaa69f5f fix logged_in_elsewhere to work when user never logged in before (new accounts) 2017-02-23 16:38:18 +00:00
Leo Hemsted
f14a836baa check users' session id.
when a user enters their 2FA code, the API will store a random UUID
against them in the database - this code is then stored on the cookie
on the front end.

At the beginning of each authenticated request, we do the following
steps:
  * Retrieve the user's cookie, and get the user_id from it
  * Request that user's details from the database
  * populate current_user with the DB model
  * run the login_required decorator, which calls
    current_user.is_authenticated

is_authenticated now also checks that the database model matches the
cookie for session_id. The potential states and meanings are as follows:

 database | cookie | meaning
----------+--------+---------
 None     | None   | New user, or system just been deployed.
          |        | Redirect to start page.
----------+--------+---------
 'abc'    | None   | New browser (or cleared cookies). Redirect to
          |        | start page.
----------+--------+---------
 None     | 'abc'  | Invalid state (cookie is set from user obj, so
          |        | would only happen if DB is cleared)
----------+--------+---------
 'abc'    | 'abc'  | Same browser. Business as usual
----------+--------+---------
 'abc'    | 'def'  | Different browser in cookie - db has been changed
          |        | since then. Redirect to start
2017-02-22 17:31:13 +00:00
Imdad Ahad
5017267210 Remove reset failed count 2017-02-20 15:07:37 +00:00
imdadahad
cdd192590f Merge pull request #1106 from alphagov/feat-update-user-profile-password-with-new-endpoint
Update password on user profile with new endpoint
2017-02-10 17:23:46 +00:00
Chris Hill-Scott
ac9d4f2daf Break down usage by month, filter by year
The previous, weekly activity breakdown was what we reckoned might be
useful. But now that we have people using the platform it feels like
aggregating a service’s usage by month is:
- matches the timeframe users report on within their organisation
- is consistent with the usage page

And like the usage page this commit also limits the page to only show
one financial year’s worth of data at once (rather than data for all
time).

This commit also makes some changes to the jobs view code so that our
aggregation of failure states is consistent between the dashboard pages
and the jobs pages.
2017-02-08 10:59:26 +00:00
Imdad Ahad
7ad56df78b Change user api client to update password with new endpoint 2017-02-07 13:31:46 +00:00
Chris Hill-Scott
2a502753a4 Filter and navigate usage by financial year
Right now we tell people that the usage page is for the current
financial year. This is a lie – it’s for all time.

So this commit calls through to the API to get the stats for (by
default) the current financial year.

We already do this for the monthly breakdown, this just does the same
thing for the yearly totals.

It also adds navigation to show the data for other financial years:
- previous so you can go back and see your usage and verify that the
  bill you’re about to pay is correct
- next so that you can check what your SMS allowance is going to be
  before you actually get into it
2017-02-06 12:25:48 +00:00
Rebecca Law
26974886ec Add Suspend and Resume service buttons to service-settings page. 2017-01-31 15:56:06 +00:00
Rebecca Law
6d883b59ad Changed deactivate service to archive service.
need to deploy https://github.com/alphagov/notifications-api/pull/808 first
2017-01-31 09:54:51 +00:00
Rebecca Law
3dfb3806d2 Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.
There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
2017-01-18 15:11:34 +00:00
Leo Hemsted
d56b7b9a58 block inactive services from making stateful changes
in the NotifyAdminAPIClient, which all api traffic goes through, return
403 for any stateful requests (post, put and delete), if the following
criteria have been met:
* a current_service is set
    (this prevents checks being carried out on non-service related
     updates, eg editing user details)
* the service is not active
* the current user is not a platform admin

so platform admins can still update anything.

Note: Without any specific error handling, the user will see a generic
403 page. This is fine, probably - it's a relatively niche case that
you'll be editing a service you can't get to anyway
2016-12-09 16:09:42 +00:00
Leo Hemsted
255ce158b7 block inactive services from making stateful changes
in the NotifyAdminAPIClient, which all api traffic goes through, return
403 for any stateful requests (post, put and delete), if the following
criteria have been met:
* a current_service is set
    (this prevents checks being carried out on non-service related
     updates, eg editing user details)
* the service is not active
* the current user is not a platform admin

so platform admins can still update anything.

Note: Without any specific error handling, the user will see a generic
403 page. This is fine, probably - it's a relatively niche case that
you'll be editing a service you can't get to anyway
2016-12-09 15:44:58 +00:00
Martyn Inglis
08dc8fb13d Use the local APIClient rather than the one from the python-api-client
- ensures that all API calls set the request ID when talking to the API.
2016-11-30 17:01:44 +00:00
Martyn Inglis
202dd7d314 Override the BaseAPI Client
- This allows us to set a custom header for admin calls only (not needed in client calls)
- Adds request-id from Middleware to the API call to ensure the API logs against the same request ID.
2016-11-30 17:00:42 +00:00
Rebecca Law
1efa5530d4 Merge pull request #1027 from alphagov/deactivate-services-all-services-list
dont show inactive services on the choose service list
2016-11-23 16:10:44 +00:00
Rebecca Law
cebf8e1d65 Removed get_all_notifications method from notification_api_client as it is not longer being used. 2016-11-18 14:39:23 +00:00
Leo Hemsted
805639a2e1 add test for choose services and related redirects to it
it'll just show the add service button if you only have archived services
2016-11-16 13:18:49 +00:00
Leo Hemsted
08881e5bd1 add get_active_services method
* all current invocations of get_services now call get_active_services
  EXCEPT for platform admin page (where we want to see inactive services
* cleaned up parameter names and unpacking (since *params is unhelpful)
* fixed incorrect kwarg name in conftest
2016-11-16 11:08:20 +00:00
Leo Hemsted
63de598d31 Merge pull request #1008 from alphagov/deactivate-service
Deactivate service
2016-11-14 11:41:13 +00:00
Imdad Ahad
1da498164f Use POST req to update a user attr 2016-11-10 12:10:01 +00:00
Imdad Ahad
f3ca33dad3 Revert original update user method and add new attribute update (with strict checking) 2016-11-09 15:06:02 +00:00
Imdad Ahad
f14c3dbfa5 Stop passing the 'whole' user object when making changes to profile 2016-11-03 11:20:24 +00:00
Leo Hemsted
a982144821 add deactivate service button on the service settings page
only visible for platform admins looking at active services.
no way to undo. no confirm button.
2016-11-02 16:53:40 +00:00
Leo Hemsted
e89f89bd11 remove unused delete service functionality 2016-11-02 10:29:44 +00:00
Leo Hemsted
730719b61f platform admins can toggle services from seeing letters 2016-10-26 16:56:51 +01:00
Rebecca Law
a0e7d569e9 Send an email to the user when they change email address
This PR changes the flow to change an email address.
Once the user enter their password, they are told "Check your email".
An email has been sent to them containing a link to notify which contains an encrypted token.
The encrypted token contains the user id and new email address. Once the link is clicked the user's email address is updated to the new email address.
They are redirected to the /user-profile page.

Also in this commit is an update from flask.ext.login to flask_login.
2016-10-13 17:05:37 +01:00
Leo Hemsted
8464c67a3d move job statuses to job_api_client
prevent code duplication and a good excuse to use set subtraction
2016-10-11 10:35:33 +01:00