Commit Graph

84 Commits

Author SHA1 Message Date
Chris Hill-Scott
c6de605311 Add basic flow for adding email _or_ sms templates
Templates now have:
- a type (email or sms)
- a subject (if they are email templates)

We don’t want two completely separate view files for email and SMS, because they
would have an enormous amount of repetition.

So this commit adds
- different templates for SMS and email templates
- different form objects for SMS and email templates

…and wires them up.
2016-02-24 09:23:38 +00:00
Chris Hill-Scott
17b99c9bf2 Add pages to invite, edit, and delete users
This takes the original prototype version of this page, and, using the same
fake data (ie nothing is wired up):
- adds an invite users page
- adds an edit (and delete) user page

Both these pages allow the user to set another user’s permissions.

This commit adds images for the ticks and crosses, so we have control over their
appearance.
2016-02-22 13:39:02 +00:00
Chris Hill-Scott
426a23decd Add a hint about how to use placeholders
Since placeholders (almost) work now, it’s worth telling people what the syntax
is.

This commit also removes the ‘template type’ picker, since you can only create
SMS templates at the moment. This will be revisited when we start looking at how
you add an email template.
2016-02-18 15:23:14 +00:00
Chris Hill-Scott
45cacd82d3 Validate CSVs fully
This commit extends the existing function to validate each row’s phone number
to also validate that all the required data is present.

It does this using the checking that the `Template` class can do when given
a template and a `dict` of values.
2016-02-18 15:07:15 +00:00
Chris Hill-Scott
6b4ede629c Use correct HTML 5 input types
These give devices a hint (although don’t mandate them) to use a numeric keypad,
or a keypad with the `@` symbol visible when entering phone numbers or email
addresses.
2016-02-17 10:42:14 +00:00
Chris Hill-Scott
26adcc64c1 Updates to ‘send SMS’ page
Based on discussion with Pete.

Make the blue banner an ‘important’ banner (copied from Register to Vote, used
because it’s not as boxy and fits on the page better).

Remove the back button because you haven’t changed any data yet. If you need to
go back you can just press back or start again.

Make the filename stand out more.

Remove the ‘download example’ link. Will need to revist the best way of doing
this.

Make text messages consistently 2/3rd width.
2016-02-04 14:06:19 +00:00
Chris Hill-Scott
4280c21b23 Updates to send and check SMS pages
Adds a back button instead of a back link (more prominent, you’re likely to
go back on these pages if you’ve made a mistake)

Tweaks to wording
2016-02-04 10:59:18 +00:00
Chris Hill-Scott
394a9db3f7 Split ‘send SMS’ page into two pages
This commit just splits the existing page into two. It doesn’t do any
substantive changes to how the two parts of the page work.
2016-02-03 11:14:20 +00:00
Chris Hill-Scott
335cc160fa Fix wording 2016-02-02 15:59:41 +00:00
Adam Shimali
9e8c0b8d59 Moved mobile validation to utils module for use in csv upload as well.
This could be moved to shared utils code base at some point.
2016-02-01 16:57:40 +00:00
Nicholas Staples
62150e5596 Added fixes for forms to hide potential email philshing scams. 2016-01-28 16:36:36 +00:00
Nicholas Staples
ca8d78aee5 Fix for forgot my password. 2016-01-27 18:01:43 +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
Nicholas Staples
96d38b8189 Added check for password on service change page, work in progress. 2016-01-22 16:34:36 +00:00
Chris Hill-Scott
cd38d54be7 Make ‘template type’ radio buttons not <select>
Because burn your select tags[1]

This commit hard codes the markup for the time being until I can work out how
to get WTForms outputting the markup I want.

1. https://www.youtube.com/watch?v=CUkMCQR4TpY
2016-01-22 14:51:00 +00:00
Chris Hill-Scott
9ee8610da0 Rename content to template content
WTForms sets the `id` of a `textarea` element to the variable name to which the
form control is assigned.

This conflicts with the page container, which is styled by targeting `#content`.
2016-01-22 14:51:00 +00:00
Rebecca Law
61893c5c7e Validation on key name is case insenstive 2016-01-21 16:52:01 +00:00
Rebecca Law
e7713a8b7f Added a validator so that the key name is unique per service. 2016-01-21 14:15:36 +00:00
Chris Hill-Scott
9784a9936c Add pages for create/view/revoke API keys
Copying what they’ve done on GOV.UK Pay, we should let users:
- generate as many keys as they want
- only see the key at time of creation
- give keys a name
- revoke any key at any time (this should be a one way operation)

And based on discussions with @minglis and @servingUpAces, the keys should be
used in conjunction with some kind of service ID, which gets encrypted with the
key. In other words the secret itself never gets sent over the wire.

This commit adds the UI (but not the underlying API integration) for doing the
above.
2016-01-20 16:22:23 +00:00
Nicholas Staples
75d7110642 Updated to send email through the client send_email. 2016-01-20 14:45:50 +00:00
Nicholas Staples
2cc9dc6995 Work in progress. 2016-01-20 11:46:39 +00:00
Nicholas Staples
cfb3f96b01 Mapped template actions to the api and mocked tests. 2016-01-19 15:54:12 +00:00
Nicholas Staples
a9fead0d82 Merge with master. 2016-01-19 09:49:01 +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
Chris Hill-Scott
81d4230b61 Page for adding a new service
This page is exactly the same as the page for adding your first service, save
the heading text.

So all this commit does is:
- set up two routes (`/add-service`, `/add-service/first`) for each of the two
  journeys and change the existing journeys to use the `/add-service/first`
  route
- add logic to show different heading text depending on the journey
- add a link to the new (`/add-service`) route in the service chooser dropdown
2016-01-18 11:03:25 +00:00
Nicholas Staples
262bbbac45 Test add service completed. 2016-01-15 16:10:24 +00:00
NIcholas Staples
a469cf6bcf Merge pull request #70 from alphagov/mobile-number-validation
Mobile number validation
2016-01-13 11:48:02 +00:00
Chris Hill-Scott
aa43bd9e75 Add the new field to the application
This commit replaces the previous `StringField` used for collecting mobile
phone numbers with the `UKMobileNumber` field.

This means changing a few of the preexisting tests to have more realistic mobile
numbers so that they still pass.
2016-01-13 09:43:32 +00:00
Chris Hill-Scott
791324588b Test for specific error messages
This commit:
- improves the tests to check for specific error messages, rather than just
  pass/fail
- makes the error messages more human, and more suggestive of what the user
  needs to do to fix the error
2016-01-13 09:43:32 +00:00
Chris Hill-Scott
faa3b9ca7c Add form field for a UK mobile phone number
This field does two things:
- validates the format of the phone number
- outputs a consistent representation of the phone number

Because of this I think it’s better represented as a new field type, rather
than individual validators.

I also think that it’s better to do this without regular expression(s), because
it makes returning the specific error easier.

This commit also adds basic pass/fail test for a series of valid/invalid
phone numbers.
2016-01-13 09:42:37 +00:00
Chris Hill-Scott
c94ac4266c Add confirmation of password for important changes
This commit adds an extra page or field for confirming your current password
when making important changes

Name                 | Email address     | Mobile number     | Password
---------------------|-------------------|-------------------|------------
No password required | As second page    | As second page    | On same page as new password
2016-01-12 15:30:18 +00:00
Chris Hill-Scott
df79dc69f6 Add loops for changing each part of your profile
This commit adds a page or series of pages for changing your:

Name              | Email address     | Mobile number     | Password
------------------|-------------------|-------------------|------------
Enter new value   | Enter new value   | Enter new value   | Enter new value
                  | Enter 2fa code    | Enter 2fa code    |
Return to profile | Return to profile | Return to profile | Return to profile

(each row is a page)
2016-01-12 15:30:18 +00:00
Adam Shimali
bfd7291426 resolve merge conflicts 2016-01-12 10:43:23 +00:00
Chris Hill-Scott
e8fe8c50ba Add a WTForms-compatible textbox macro
This macro:
- accepts a WTForm form field as a parameter
- renders a form field which follows the GOV.UK Elements patterns, both visually
  and in markup terms

It then changes any page which uses either:
- the old, non-WTForms macro or
- the old, WTFforms `render_field` macro

…to use this new macro and removes both of the old ones.

It also adds the option to display hint text above the textbox.
2016-01-11 15:20:00 +00:00
Adam Shimali
584533eb11 First slice of csv upload of phone numbers for sending messages.
At the moment the file contents are not persisted by checked in
memory.

The first and last three records are show if all are valid.

If there are invalid rows, they are reported and the user is
prompted to go back and sort out upload file.

The storing of upload result (i.e. validation of file) in session
will be removed in next story which is about persisting of file
for later processing.
2016-01-11 15:00:51 +00:00
Rebecca Law
f7373ee5fc Fix wording
Changed forgot-password so that it does not expose to the user that the email address does not exist.
2016-01-11 12:23:08 +00:00
Chris Hill-Scott
677f8891b2 Fix layout and wrong word 2016-01-11 12:23:08 +00:00
Rebecca Law
9ca2f2017f Fix argument 2016-01-11 12:23:08 +00:00
Rebecca Law
c858869a52 Removed exceptions, found a better way to handle them.
Refactored the forms so that fields like email_address can be used in multiple forms.
Refactored form validation so that a query function is passed into the form to be run, this
way the form is not exposed to the dao layer and the query is more efficient.

This PR still requires some frontend attention. Will work with Chris to update the templates.
2016-01-11 12:23:08 +00:00
Rebecca Law
ceb78f49b4 Take out the Canadian politeness.
Make the error message more consistent.
Extracted common fields for the forms.
2016-01-11 12:23:08 +00:00
Rebecca Law
a860f713d2 Implementation of the new_password endpoint.
Found a way to create the token that does not need to persist it to the database.
This requires proper error messages, written by people who speak menglis good.
2016-01-11 12:23:07 +00:00
Rebecca Law
b5901a1ac7 New-password endpoints are implemented.
There should be a better way to validate the token.
2016-01-11 12:23:07 +00:00
Rebecca Law
2cb896fa81 Completion of forgot-password endpoints.
Start implementation for new-password endpoints.
Created PasswordResetToken model
ToDo: create and save token, send valid url to user,
check validity of token, update user's password, redirect to /two-factor.
2016-01-11 12:23:07 +00:00
Rebecca Law
6696426dbc Add endpoints for forgot-password. 2016-01-11 12:22:39 +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
52df795743 Review fix. 2016-01-06 17:00:01 +00:00
Nicholas Staples
9d7c3566aa Removed validation check for unique mobile number on the system. 2016-01-06 09:54:10 +00:00
Nicholas Staples
ecc3485d72 Merge conflicts with master. 2016-01-05 17:24:13 +00:00