Commit Graph

41 Commits

Author SHA1 Message Date
Chris Hill-Scott
e0e445c520 Stop enumeration of email addresses via forgot pw
https://www.pivotaltracker.com/story/show/113840073

Previously the forgot password page would give an error if you entered an email
address which didn’t belong to an account.

This would allow a potential attacker to know which email addresses were
registered.

This commit changes the response to always be the same, whether or not the email
address exists.

Also, this is a good read about the dangers of asserting whether a mocked method
was called: http://engineeringblog.yelp.com/2015/02/assert_called_once-threat-or-menace.html
2016-02-17 10:42:15 +00:00
Chris Hill-Scott
d5656a4dc2 Add mocked get_services to test_client.login
Because the redirect after logging in checks the number of services a user has,
this now needs to be mocked.

Right now this means adding `mock_get_login` to any tests that need a login.
This must be one of the first mocks, so that it can be overridden by any use
of `mock_get_services`, for tests that specifically want to rely on a quantity
of mocked services, or their contents.

This is a bit fragile, but there’s already a TODO in the code to make it better
so ¯\_(ツ)_/¯
2016-02-05 15:11:44 +00:00
Chris Hill-Scott
939954cd64 Skip ‘choose service’ page if user has one service
We used to do this by redirecting on the choose service page. However when we
lost the dropdown and this page also became the page for adding a new service
(in 3617f2e936) the redirect was removed.

This commit re-adds the redirect on the two factor page, so that it only happens
on first login.

So the flows are:

**Multiple services**
```
`Sign in` → `Enter two factor code` → `Choose service` → `Service dashboard`
```

**One service**
```
`Sign in` → `Enter two factor code` → `Service dashboard`
```

**No services (you’ve deleted all your services)**
`Sign in` → `Enter two factor code` → `Choose service` → `Add new service`
2016-02-05 14:50:55 +00:00
Adam Shimali
90a17bc0a7 Service and job id were incorrectly in bucket name. 2016-02-04 12:06:06 +00:00
Rebecca Law
a4cb35ad3b Update service_id to a UUID from an integer.
This commit must go along side a commit on the notifications-api app.
There will be a breif outage until both app are deployed.
2016-02-02 14:25:31 +00:00
Adam Shimali
4ea50499c3 List and individual job pages now fetch data from api.
Few bug fixes around job uuid.
2016-01-29 15:35:35 +00:00
Adam Shimali
5196436645 Better bucket name pending possible change to uuid for service primary
key.

Also small bugfix around file name and original file name
2016-01-29 12:19:50 +00:00
Adam Shimali
0995cd2e3c Uploading csv creates job via api 2016-01-29 10:30:02 +00:00
Nicholas Staples
2d35f5f36a All tests passing and merged with master. 2016-01-27 16:30:33 +00:00
Nicholas Staples
6959d695d3 Working tests, hopefully all code changes done. 2016-01-27 12:22:32 +00:00
Chris Hill-Scott
a6d19ff45b Show correct default state on service settings page
By default a service should be active (ie keys not suspended). For some reason
the API is returning the opposite.

This commit reverses the logic to make it look right for hack day.
2016-01-26 17:16:24 +00:00
NIcholas Staples
d89174f322 Merge pull request #108 from alphagov/test-cleanup
Test cleanup
2016-01-26 10:53:49 +00:00
Chris Hill-Scott
46a7410839 Add test for template page repopulation
A bug was found whereby the body of a template was not being shown in the
on the page when returning to edit an existing template. This bug was caused
by renaming the field in some places, but not in the `Form` class.

This bug has since been fixed, but this commit adds a test to make sure that it
doesn’t happen again.
2016-01-25 07:20:13 +00:00
Adam Shimali
3d14296ae0 Re introduced some tests. Moved update email from db to api. 2016-01-24 15:00:50 +00:00
Adam Shimali
4674bd6b68 Reintroduce some tests. A bit of cleanup of mocks.
User object fields made a bit clearer and simple test to
verify user added.
2016-01-23 23:14:50 +00:00
Rebecca Law
6ef9becf8f Able to get services by user id 2016-01-22 16:46:59 +00:00
Rebecca Law
46e0e3fd1b Merge branch 'master' into api-keys-flow
Conflicts:
	tests/app/main/views/test_api_keys.py
2016-01-21 15:50:00 +00:00
Rebecca Law
8737edfad1 Merge branch 'master' of github.com:alphagov/notifications-admin into api-keys-flow
Conflicts:
	tests/app/main/views/test_api_keys.py
2016-01-21 12:31:28 +00:00
Adam Shimali
167c7b0f13 Fixed some tests. Some broken mocked tests commented out until later 2016-01-21 12:31:09 +00:00
Rebecca Law
90fca93308 Implementation of api key pages.
Revoke page will show the correct key name
Show api keys shows a well formatted expiry date
Fix tests for api key endpoints.
2016-01-21 12:28:05 +00:00
Adam Shimali
ee23df2c73 some tests fixed 2016-01-21 12:12:06 +00:00
Adam Shimali
856b6adb56 First slice full sign in flow 2016-01-21 11:33:53 +00:00
Rebecca Law
41c775cd68 Created api_key_api_client.
Implementation of create, revoke and show api keys for service.
These calls work, however we still need to fix the tests.
2016-01-20 17:32:55 +00:00
Adam Shimali
7af53761d9 fixed some mocks in test 2016-01-20 16:36:06 +00:00
Adam Shimali
ca3d3240a6 Verify activate and login user with sms and email code 2016-01-20 15:34:42 +00:00
Adam Shimali
b5cdf86b40 User registration now creates user via api.
Verification flow is still to be completed.

Foreign key constraint on verify codes to user table removed.
2016-01-19 22:49:46 +00:00
Nicholas Staples
f6f4fe15b2 Merge with master. 2016-01-19 16:35:52 +00:00
Adam Shimali
c86b53f7f1 Add user via api
Leave original user object in for this slice. Remove on next
2016-01-19 16:07:44 +00:00
Nicholas Staples
cfb3f96b01 Mapped template actions to the api and mocked tests. 2016-01-19 15:54:12 +00:00
Nicholas Staples
609f5f0a8d Working service integration. 2016-01-18 17:35:28 +00:00
Nicholas Staples
6e19dd7c9c Added choose_service using services_dao. 2016-01-18 16:01:04 +00:00
Nicholas Staples
4e2019c949 Work in progress, all tests passing and implemented mocks for services_dao. 2016-01-15 17:46:09 +00:00
Nicholas Staples
3b1d521c10 Tests added for dao. 2016-01-15 15:15:35 +00:00
Nicholas Staples
7001d8261d Fix for security hole with setting session['user_id'] before second factor of authentication has been authorised. 2016-01-07 12:43:10 +00:00
Nicholas Staples
10c2978f85 Merge with master and test fix. 2016-01-06 17:17:02 +00:00
Nicholas Staples
79c15ec9cf Code checks and all tests passing. 2016-01-06 16:51:35 +00:00
Nicholas Staples
5905229714 Logout functionality and test added. 2016-01-06 16:40:38 +00:00
Rebecca Law
588730d594 109526036: Persist the verify code to the db.
The codes are hashed and saved to the db.
The code is marked as used once a valid code is submitted.
The code is valid for 1 hour.
The codes are no longer saved to the session.
2015-12-10 14:48:01 +00:00
Rebecca Law
9e2cf2fa4c 108536366: Implement register flow
Includes validation for gov.uk email address, mobile number with +44, password at least 10 char.
Form validation errors will be added to template in a later story.
User is created when form validates.
2015-12-01 16:45:11 +00:00
Rebecca Law
7f96ef5a25 108536490: Initial effort to implement log in
Add endpoint for post to /sign-in
Initialise role data
2015-12-01 10:00:06 +00:00
Rebecca Law
abe1d8ae17 108536234: created users and roles data and domain model.
You will need to run the /scripts/bootstrap.sh to create the database for test and the app.
2015-11-25 15:29:12 +00:00