Commit Graph

82 Commits

Author SHA1 Message Date
Kenneth Kehl
e900a7c81f redirect new users to templates section 2024-07-25 09:10:25 -07:00
Kenneth Kehl
7b5fdd41df fix raw set 2024-06-20 11:50:51 -07:00
Kenneth Kehl
da96edbfcd fix set and get in redis_client 2024-06-07 09:07:42 -07:00
Carlo Costino
f6cf493266 Update expired and cancelled service invite handling
This changeset adds a bit of extra handling for expired and cancelled service invites so that users can no longer accept them and are provided with more detailed error messages.

Signed-off-by: Carlo Costino <carlo.costino@gsa.gov>
2024-05-31 17:20:08 -04:00
Kenneth Kehl
622255e5a6 merges 2024-05-20 13:19:14 -07:00
Kenneth Kehl
9ba5e3b917 code review feedback 2024-05-20 12:09:49 -07:00
Kenneth Kehl
e660541e9c Exception Investigation: app.notify_client:InviteTokenError 2024-05-16 09:11:11 -07:00
Kenneth Kehl
d47f9933d2 add check for government email addresses 2024-05-13 13:39:51 -07:00
Kenneth Kehl
c578175e53 write new tests 2024-05-10 07:51:32 -07:00
Kenneth Kehl
11beff2541 get it working 2024-05-09 14:04:30 -07:00
Kenneth Kehl
7f72599401 notify-admin-1501 2024-05-09 13:08:34 -07:00
Kenneth Kehl
852c0e57c8 convert to test fixture 2024-05-08 11:30:51 -07:00
Kenneth Kehl
1d9457f9a2 add debug statements 2024-05-07 14:36:21 -07:00
Kenneth Kehl
9c40a10900 cleanup 2024-05-07 13:58:59 -07:00
Kenneth Kehl
78e8dc95fe fix tests 2024-05-06 13:12:27 -07:00
Kenneth Kehl
0b30c9a83f merge from main 2024-05-06 12:15:57 -07:00
Kenneth Kehl
f0f0661f2a Update app/main/views/register.py
Co-authored-by: Carlo Costino <ccostino@users.noreply.github.com>
2024-04-25 14:00:28 -07:00
Kenneth Kehl
4818b7ce14 code review feedback 2024-04-25 13:48:14 -07:00
Kenneth Kehl
84180fd8e1 Update app/main/views/register.py
Co-authored-by: Carlo Costino <ccostino@users.noreply.github.com>
2024-04-25 13:39:21 -07:00
Kenneth Kehl
f7fe270171 fix service invites 2024-04-24 11:20:17 -07:00
Kenneth Kehl
f092ad8f98 handle case where existing user is invited to another service 2024-03-28 13:20:22 -07:00
Kenneth Kehl
04eaec6dd6 fix register 2024-03-19 14:36:43 -07:00
Kenneth Kehl
b12e638592 fix registration 2024-03-19 14:34:41 -07:00
Kenneth Kehl
c053cc7402 change timezone to hidden field with default for now 2024-03-19 13:30:50 -07:00
Kenneth Kehl
197ef11075 fix tests 2024-03-19 11:32:36 -07:00
Kenneth Kehl
4e6f143675 fix register from join service 2024-03-19 09:30:20 -07:00
Jonathan Bobel
05495f4d42 Updating the route 2024-03-18 13:50:23 -04:00
Kenneth Kehl
8c9721d8e2 notify-api-412 use black to enforce python coding style 2023-08-25 09:12:23 -07:00
Steven Reilly
13d0e46b52 blunt rename of org (#620) 2023-07-12 12:09:44 -04:00
Chris Hill-Scott
92ffe3a78c Use meta tag to tell search engines not to index
Google’s documentation says:

> robots.txt is not a mechanism for keeping a web page out of Google. To
> keep a web page out of Google, you should use noindex directives

A noindex directive means adding the following meta tag to pages that
shouldn’t be indexed:
```html
<meta name="robots" content="noindex" />
```

It’s also possible to set the directive as a HTTP header, but this seems
trickier to achieve on a per-view basis in Flask.

I’ve implemented this as a decorator so it can quickly be added to any
other pages that we decide shouldn’t appear in search results.
2020-05-27 10:19:48 +01:00
Chris Hill-Scott
628e344b36 Make user API client return JSON, not a model
The data flow of other bits of our application looks like this:
```
                         API (returns JSON)
                                  ⬇
          API client (returns a built in type, usually `dict`)
                                  ⬇
          Model (returns an instance, eg of type `Service`)
                                  ⬇
                         View (returns HTML)
```
The user API client was architected weirdly, in that it returned a model
directly, like this:

```
                         API (returns JSON)
                                  ⬇
    API client (returns a model, of type `User`, `InvitedUser`, etc)
                                  ⬇
                         View (returns HTML)
```

This mixing of different layers of the application is bad because it
makes it hard to write model code that doesn’t have circular
dependencies. As our application gets more complicated we will be
relying more on models to manage this complexity, so we should make it
easy, not hard to write them.

It also means that most of our mocking was of the User model, not just
the underlying JSON. So it would have been easy to introduce subtle bugs
to the user model, because it wasn’t being comprehensively tested. A lot
of the changed lines of code in this commit mean changing the tests to
mock only the JSON, which means that the model layer gets implicitly
tested.

For those reasons this commit changes the user API client to return
JSON, not an instance of `User` or other models.
2019-06-05 11:13:41 +01:00
Katie Smith
bbc7b173f0 Ensure non-gov invited users get added to services
We were adding invited users to services in the `main.add_service` view
function as the last step in the process of inviting users. Since this
view function is decorated with `@user_is_gov_user`, invited users with
non-governmental email addresses would never reach this point and would
be able to register an account but would not get linked to a service.

To fix this, we now add the invited user to the service at the point at
which the user gets activated and also ensure that non-gov users don't
get redirected to a page which they don't have permission to view.
2019-01-22 09:52:55 +00:00
Chris Hill-Scott
be9fb99247 Redirect signed-in users to their service
Some users are bookmarking the sign in page for quick access to their
Notify service.

If they’re already signed in when they used this bookmark they get
redirected. However the redirect isn’t very smart, because it just takes
them to their list of services. This isn’t great if they only have one
service.

This commit redirects them to the `show_accounts_or_dashboard` endpoint
instead, which does the work to figure out which page is most useful
to show someone when they sign in.

Also changing this for `/register`, although it’s less likely that
someone will have bookmarked this page.
2018-11-15 16:01:59 +00:00
Leo Hemsted
2f37e37278 rename choose_service to choose_account 2018-03-14 15:39:55 +00:00
Chris Hill-Scott
f3a0c505bd Enforce order and style of imports
Done using isort[1], with the following command:
```
isort -rc ./app ./tests
```

Adds linting to the `run_tests.sh` script to stop badly-sorted imports
getting re-introduced.

Chosen style is ‘Vertical Hanging Indent’ with trailing commas, because
I think it gives the cleanest diffs, eg:
```
from third_party import (
    lib1,
    lib2,
    lib3,
    lib4,
)
```

1. https://pypi.python.org/pypi/isort
2018-02-27 16:35:13 +00:00
chrisw
22bbc0d6d8 invite-team-members 2018-02-23 11:43:13 +00:00
Leo Hemsted
8c14113da5 only show mobile number on register from invite page if user is sms_auth
also clean up the way the form is invoked - it now populates from an
invited_user object
2017-11-14 15:53:38 +00:00
Leo Hemsted
c8dbd819ef add tests for registering from an email_auth invite 2017-11-14 15:18:14 +00:00
Leo Hemsted
65ba7e88c8 refactor RegisterFromInvite to make auth_type required, and update test fixtures 2017-11-14 15:18:14 +00:00
chrisw
79393c97ef Updated invite email auth user flow 2017-11-14 15:18:14 +00:00
Chris Hill-Scott
1a05e33fa4 Fix 500 error if revisiting registration page
If you go back to this part of the registration flow then you get a 500
error, because we’re relying on something in the session. We clear the
registration info from the session after you’ve registered successfully.

Also there were no tests for the happy path of this page either
¯\_(ツ)_/¯
2017-04-27 11:55:50 +01:00
Rebecca Law
7b54e0c463 After investigating a 500 in the admin app, I found an edge case in the invitation registration flow that can cause an error.
The flow is as follows:
If the invited user clicks on the /invitation/<token> link in the email (now on /register-from-invite),
then goes to another browser and registers for Notify.
Coming back to the other browser, submit the form for /register-from-invite.

This PR fixes that bug and adds a couple tests for register_from_invite
2016-12-22 11:43:11 +00: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
Rebecca Law
43938936f3 If a user has already registered with the email they will get a different email when the register again.
The email includes likes to sign in and send feedback
2016-07-12 11:53:30 +01:00
Adam Shimali
0544ea776b Change when invite gets marked as accepeted. 2016-06-08 11:52:26 +01:00
Nicholas Staples
af500a96e7 Update all dates to use utc, only in the template is it converted to british time. 2016-05-11 11:20:45 +01:00
Adam Shimali
09117e5eeb Updated flask-login to version 0.3.2 2016-05-04 14:06:14 +01:00
Adam Shimali
2792bece54 Changed registration flow to first send email verification link that
when visited sends sms code for second step of account verification.

At that second step user enters just sms code sent to users mobile
number.

Also moved dao calls that simply proxied calls to client to calling
client directly.

There is still a place where a user will be a sent a code for
verification to their email namely if they update email address.
2016-03-17 15:19:51 +00:00
Adam Shimali
4adbcebc6f Do not send email in case of invite.
The user does not have to validate the email token, but it
was still being sent.
2016-03-15 16:58:26 +00:00
Rebecca Law
4ba801edab Merge branch 'master' into error-handling
Conflicts:
	app/main/views/invites.py
2016-03-10 15:03:21 +00:00