Commit graph

212 commits

Author SHA1 Message Date
Pēteris Caune
e3cbe79f57
Update CustomHeaderMiddleware to normalize email addresses to lower case
Also add a data migration to normalize any already existing user
accounts with non-lower-case email addresses too.

Fixes: #1074
2024-10-24 13:22:37 +03:00
Pēteris Caune
fd96cc794b
Remove unused bits 2024-10-04 17:34:30 +03:00
Pēteris Caune
1bdfbac775
Fix Sign In page to hide "Email Link" option if SMTP is not configured
Fixes: #922
2024-05-10 11:04:21 +03:00
Pēteris Caune
33e58fa014
Change the signup flow to accept registered users
(and sign them in instead)
2024-03-15 17:30:06 +02:00
Pēteris Caune
ce1d7bd4cb
Add a test for #930 2023-12-18 15:58:04 +02:00
Pēteris Caune
96823a7f90
Add logging for failed webauthn key registrations 2023-11-17 16:06:39 +02:00
Pēteris Caune
7e7cbe9f75
Fix the Login form to not perform form validation in GET requests 2023-10-22 10:45:06 +03:00
Pēteris Caune
a308997b3a
Remove most of the hc.payments stuff
Why remove:

* For self-hosters, payment-related features are unused and dead weight
* For SaaS (any would-be Healthchecks.io competitors), the existing
  payment handling logic is not very useful either, as it would need to
  be heavily modified to match their business model, pricing, chosen
  payment gateway
* For the hosted service (Healthchecks.io), the up-to-date billing code
  lives in a private fork of this repo. Maintenance is easier if this
  repo does not have an older, diverging version of the same
  functionality

A few payment-related bits are staying at least for time being:

* the "USE_PAYMENTS" setting
* the hc.payments.models.Subscription model
* tiny stubs for the "Pricing" and "Billing" pages

They are used in various places in the code and templates,
and I think ripping them out in one go would be too disruptive.
2023-10-19 14:17:44 +03:00
Pēteris Caune
fa9db53631
Update admin to use format_html instead of string interpolation 2023-10-06 13:54:15 +03:00
Pēteris Caune
7b1258ceaa
Improve type hints in accounts admin, fix HTML escaping issue
In Project admin, when listing project members, for single-member
projects the owner's email address was being displayed
unescaped. This allowed unescaped amperstand and quote characters
to appear in HTML output.
2023-10-05 16:04:21 +03:00
Pēteris Caune
9153c1a552
Improve type hints 2023-09-05 13:31:59 +03:00
Pēteris Caune
2901f03146
Fix type warnings 2023-09-03 09:04:38 +03:00
Pēteris Caune
aaa172cd28
Improve type hints 2023-08-29 17:52:20 +03:00
Pēteris Caune
afd3d62c08
Improve type hints 2023-08-29 16:51:22 +03:00
Pēteris Caune
26725b9f4e
Add an "Account closed." confirmation message after closing an account 2023-08-24 09:07:41 +03:00
Pēteris Caune
ea89237c16
Fix hc.accounts.views.check_token to handle non-UUID usernames
Fixes: #882
2023-08-22 13:45:54 +03:00
Pēteris Caune
455dc66ce2
Update senddeletionscheduled to also notify over configured channels 2023-08-21 15:38:11 +03:00
Pēteris Caune
a7395115db
Fix "createsuperuser" to reject already registered email addresses
Fixes: #880
2023-08-21 13:57:40 +03:00
Pēteris Caune
582372d27f
Rename senddeletionnotices -> sendinactivitynotices 2023-08-21 12:56:27 +03:00
Pēteris Caune
abe0b28926
Update senddeletionnotices to handle inactive team members 2023-08-14 21:04:41 +03:00
Pēteris Caune
f8c869596a
Fix "senddeletionnotices" to recognize "Supporter" subscriptions 2023-08-02 12:40:29 +03:00
Pēteris Caune
c6afd94baf
Fix "senddeletionscheduled" to avoid duplicate recipients 2023-07-17 11:35:49 +03:00
Pēteris Caune
fc91838774
Update senddeletionscheduled to put multiple rcpts in To: field 2023-07-17 09:48:27 +03:00
Pēteris Caune
05742f42f9
Update the senddeletionscheduled command to notify team members too 2023-07-14 09:51:36 +03:00
Pēteris Caune
c69c1f5ec4
Add management command for sending "scheduled for deletion" warnings 2023-07-04 12:50:50 +03:00
Viktor Szépe
573b76a082
Fix typos (#855) 2023-07-02 15:14:13 +03:00
Pēteris Caune
011b97f75a
Fix signup tests to pass regardless of REGISTRATION_OPEN value 2023-06-28 15:26:39 +03:00
Pēteris Caune
518dee4ae2
Update the login_webauthn view to return HTTP 404 when RP_ID is not set 2023-06-08 10:49:57 +03:00
Pēteris Caune
0a724a44c7
Change timezone.now import in hc.lib.date and fix tests 2023-05-04 11:02:09 +03:00
Pēteris Caune
1fd343a820
Remove usages of django.utils.timezone.utc which is deprecated 2023-05-04 10:56:19 +03:00
Pēteris Caune
db8749e38f
Fix tests to use Mock.assert_called_once() and Mock.assert_not_called() 2023-05-04 10:27:56 +03:00
Pēteris Caune
e722404842
Fix tests 2023-04-04 11:57:47 +03:00
Pēteris Caune
a5324ac13c
Make warnings about no backup second factor more assertive 2023-04-04 11:53:34 +03:00
Pēteris Caune
3d728325fe
Fix the SameSite and Secure attributes on the "auto-login" cookie
The "auto-login" cookie is a part of a work-around for
some email clients automatically clicking links in emails:

- when sending an one-time sign-in link, server also sends the
  "auto-login" cookie to the client
- when end user clicks on the sign-in link, the server checks
  if client's request contains the "auto-login" cookie
- if the "auto-login" cookie is present, log the user in
- if the "auto-login" cookie is absent, serve a HTTP POST form
  with a submit button. The user must click the button to log in.

This commit fixes attributes on the "auto-login" cookie:

- it sets SameSite=Lax
- it sets Secure=true if SESSION_COOKIE_SECURE=True
2023-02-15 09:17:09 +02:00
Pēteris Caune
e46cf3725b
Add CSRF protection in the signup view 2023-02-14 09:15:46 +02:00
Pēteris Caune
09593c80d9
Fix a crash in the "createsuperuser" management command
Fixes: #779
2023-01-26 09:20:35 +02:00
Pēteris Caune
2cfb37f097
Add rate limiting by client IP in the signup and login views 2023-01-23 14:35:45 +02:00
Pēteris Caune
359edbd270
Fix login and signup views to make email enumeration harder 2023-01-23 13:05:49 +02:00
Pēteris Caune
f849c5e1a1
Fix wording in the invite email when inviting read-only users 2023-01-12 10:14:18 +02:00
Pēteris Caune
2bf0d0dbc5
Fix special character encoding in project invite emails 2022-12-22 12:05:37 +02:00
seidnerj
c82c1a3a4a
Added duration to ping details (#720)
* Added duration to ping details. This is useful on a device with a small screen, since the duration cannot be seen in the main view so now one can see it in the ping's details.
* Changed terms across the board from "delta" to "duration"
* timedelta is now consistently imported as "td" across the entire project (even in Django generated migration files)
2022-11-01 09:18:34 +02:00
Pēteris Caune
03f46630eb
Format with black 2022-10-17 17:02:11 +03:00
Pēteris Caune
161430fb10
Sort imports and add "from __future__ import annotations" 2022-10-17 16:52:15 +03:00
Pēteris Caune
b54c5381e1
Fix tests to pass when SITE_LOGO_URL is set 2022-08-25 10:45:56 +03:00
Pēteris Caune
8ca0e2d636
Remove deprecated django.utils.timezone.utc usage 2022-08-04 11:24:06 +03:00
Pēteris Caune
438c94efb7
Fix a race condition in the "Change Email" flow
The race scenario was as follows:

* Alice initiates email address change to bob@example.org
* a verification link is sent to bob@example.org
* separately, somebody creates a new account for bob@example.org
* Alice clicks on the verification link

At this point,
- if the database has an uniqueness constraint on auth_user.email,
  Alice will receive a HTTP 500 error
- if there's no uniqueness constraint, the email change
  will succeed and the system will have two accounts with the
  same email address

The simple fix is to re-check the address availability just
before finalizing the email address change. Currently this is
not done in a transaction block, so the race condition still
exists in theory, but is much less likely to happen in practice.
2022-07-21 15:14:51 +03:00
Pēteris Caune
2b623453c1
Update tests 2022-06-19 12:31:27 +03:00
Pēteris Caune
c1ff8875e3
Implement login link expiration
Login links will now expire in 1 hour.
2022-05-30 15:48:51 +03:00
Pēteris Caune
901f944055
Test pyflakes warnings 2022-05-26 21:39:53 +03:00
Pēteris Caune
09a99d3e9c
Add tests 2022-05-20 18:14:43 +03:00