Commit graph

2058 commits

Author SHA1 Message Date
Andy Allan
1a11c4dc19 Use a state machine for user status
The user status is a bit complex, since there are various states and
not all transitions between them make sense.

Using AASM means that we can name and restrict the transitions, which
hopefully makes them easier to reason about.
2022-01-12 18:16:14 +00:00
Tom Hughes
d6da1499fc Avoid putting ActionController::Parameters objects in the session 2022-01-11 19:43:43 +00:00
Tom Hughes
8e8f6ef990 Attempt to avoid polynomial time matches on user supplied data 2022-01-05 18:38:15 +00:00
Tom Hughes
d2337810a3 Remove redundant OpenID URL expansion code
It was only used for Google who have long since dropped OpenID support.
2022-01-04 12:02:02 +00:00
Tom Hughes
fea1b5b88d Fix new rubocop warnings 2021-12-28 19:47:51 +00:00
Andy Allan
a863be8831 Rename User#delete to User#destroy
"delete" is generally used for immediate SQL deletion without running
any callbacks or other ruby code, whereas "destroy" will trigger callbacks.

Although we don't currently use any callbacks, let's rename this method to
align better with the convention.
2021-12-22 11:32:33 +00:00
Andy Allan
a8e8ba1a64 Refactor the account edit/update pages out into a separate accounts controller 2021-12-08 15:17:50 +00:00
Tom Hughes
1a65c279aa Merge remote-tracking branch 'upstream/pull/3382' 2021-11-25 17:19:26 +00:00
Andy Allan
3aa8292d6d Drop the trace_use_job_queue option
This has been set as true by default, and in production, for many
years. I don't think there's much use in keeping the setting around
any longer.
2021-11-24 15:23:27 +00:00
Andy Allan
18c70fa2de Add a user link to the heading of the diary comments page
Fixes #3369

This makes the heading match the layout of the user's Notes page,
which also has a short heading and a subheading with a link.

Additionally, add a page title, again for consistency
2021-11-24 10:55:09 +00:00
Tom Hughes
abbd5a30d4 Validate any origin passed the auth failure callback
Fixes #3375
2021-11-23 17:33:19 +00:00
Tom Hughes
407b61857e Improve fallback behaviour for unsafe referer redirects 2021-11-23 17:18:41 +00:00
Tom Hughes
31e638474a Handle authentication failure callbacks with no message 2021-11-23 17:01:06 +00:00
Tom Hughes
d951621c44 Make safe_referer handle invalid URIs 2021-11-23 11:27:02 +00:00
Tom Hughes
02fb858956 Send plain errors for non HTML resources
Without this we throw a second error when we can't find a view
of the correct format and issue a 500 response.
2021-11-16 12:44:52 +00:00
Tom Hughes
d66d67805d Serve an updated TOTP token with the browse query response 2021-10-25 20:28:53 +01:00
Tom Hughes
99546ae0a1 Specify the controller when redirecting a failed login
This ensures that third party logins, whose callback is processed
by the users controller, go to the right place.
2021-10-24 10:38:35 +01:00
Tom Hughes
0b43f6b5a0 Drop duplicate unconfirmed_login definition
This allows third party logins to use the common definition from
the SessionMethods concern which specifies the controller.
2021-10-24 10:37:08 +01:00
Tom Hughes
5966acc207 Merge remote-tracking branch 'upstream/pull/3300' 2021-10-07 17:45:07 +01:00
Andy Allan
95e5178bfb Refactor tracepoint index to use an xml builder view
This avoids constructing xml by hand in both the controller and
the model, and opens the way for other rendering in future.

The complexity of deciding which point goes where, along with revisiting
previous tracks and tracksegs means that I've broken it down into
two parts - sorting the points into the right trksegs is done first,
before rendering them all as xml. I couldn't find a way to allow
revisiting using the builder.
2021-09-29 15:14:53 +01:00
Tom Hughes
e91c02f2ce Merge remote-tracking branch 'upstream/pull/3297' 2021-09-15 18:44:23 +01:00
Andy Allan
76f1d7bc78 Use a builder to render changeset downloads 2021-09-15 16:33:04 +01:00
Tom Hughes
f4d1d97848 Add a privileged scope that allows email addresses to be returned 2021-08-26 17:22:25 +01:00
Tom Hughes
6c6e8883f7 Introduce privileged scopes that only an administrator can enable 2021-08-26 17:22:24 +01:00
Tom Hughes
cc461b126d Correct policing of access to private user details 2021-08-24 17:49:08 +01:00
Andy Allan
cb7b79a58f Split the non-public information off of the profile page
This opens up many possibilities for more interesting things to be
shown on the dashboard, as well as making it easier to find if
you have lots of content in your profile.
2021-08-18 13:32:36 +01:00
Tom Hughes
7d46f5db60 Fix new rubocop warnings 2021-08-17 18:17:18 +01:00
Andy Allan
d797de4317 Use user_account_path for links to settings page
Much easier to read than having to be explicit about controllers etc
2021-08-12 17:09:07 +01:00
Andy Allan
36f6d8d85d Fix redirect to terms path when not logged in
This was missed during #3147 since it wasn't covered by a test.
2021-07-28 16:36:13 +01:00
Tom Hughes
f1935b1c57 Merge remote-tracking branch 'upstream/pull/3257' 2021-07-21 19:24:31 +01:00
Andy Allan
403c8941a6 Ensure that flash message is shown in the updated language 2021-07-21 18:58:47 +01:00
Andy Allan
29efa4337c Remove incorrectly spelled helper_method
The spelling of language is wrong here, and the correct version
is already there further down at the preferred_language method definition
2021-07-21 17:28:23 +01:00
Tom Hughes
cd9a72e669 Merge remote-tracking branch 'upstream/pull/3263' 2021-07-21 12:16:08 +01:00
Andy Allan
37b03e47c6 Fix various code comments
These were found as part of #3233
2021-07-21 11:24:23 +01:00
Tom Hughes
4d47cff5e1 Merge remote-tracking branch 'upstream/pull/3237' 2021-07-21 11:24:17 +01:00
Andy Allan
caf2e2a242 Move profile-related settings to their own form
Refs #3167
2021-07-14 17:45:19 +01:00
Andy Allan
9b8f2bbcbe Remove code complexity around resetting language preferences
This was originally introduced since we saved the user and showed
the result on the same action. Now that the preferences controller
saves and redirects, the user model and associated language preferences
are reloaded between requests, and this code is no longer required.
2021-07-14 17:40:20 +01:00
Andy Allan
2403630da8 Split user preferences into a separate page
Refs #3167
2021-07-14 17:40:20 +01:00
Tom Hughes
e4ce1c5f2f Check that the permission is non-zero
Fixes #3241
2021-07-01 16:35:29 +01:00
Tom Hughes
ef092045e0 Fix some broken translation lookups 2021-06-29 19:14:50 +01:00
Tom Hughes
b4a1e41968 Switch web site to use OAuth 2 2021-06-27 19:00:36 +01:00
Tom Hughes
608aafbf14 Make /api/0.6/permissions work for OAuth 2 clients 2021-06-27 00:38:16 +01:00
Tom Hughes
8d76be71bb Merge remote-tracking branch 'upstream/pull/3177' 2021-06-24 08:43:18 +01:00
Andy Allan
0876ea0bee Refactor terms declined flash message to use a partial
This allows us to include a link in the flash message, without having
to use html_safe. Also refactor to avoid having html angle brackets in
the translation strings, while still allowing locale-specific urls.
2021-06-23 20:11:19 +01:00
Andy Allan
24f6aeda6a Use hash-based flash objects to render complex flash messages
Since flash objects can only be String, Hash or Array (notably excluding SafeBuffers), then this approach is necessary to render complex html in a safe manner.

Each local can be treated as an (unsafe) string, and therefore escaped normally when rendered into the template. The template (and translation strings) can
contain html since they are no longer stored in the flash as a plain string.

Fixes #3215
2021-06-23 20:10:55 +01:00
Tom Hughes
d02b8d9f1e Merge remote-tracking branch 'upstream/pull/3226' 2021-06-16 18:07:38 +01:00
Tobias Jordans
f4e998804d Traces#index: Introduce tab navigation, fix tag-filter
- introduce bootstrap tabs to switch the views
- introduce `content_for :heading_class` to remove the padding below the bootstrap tabs
- update the rss-image to use a svg, adopted from https://icons.getbootstrap.com/icons/rss/ (without the outer border)
- move rss- and new-button away from the view-switching actions
- the `@tag` logic was broken. introduce new link to remove the tag-filter; the tabs keep the filter once given; use params[:tag] directly in the view
- use `&.` syntax nil-safety so we can remove `@display_name`
2021-06-16 15:55:55 +01:00
Andy Allan
4e45f3a76f Fix the email address that's suggested for whitelisting
Refs #3215
2021-06-16 15:37:40 +01:00
Andy Allan
63c82ed72f Set updated_by when resolving issues
Refs #3211
2021-06-09 15:47:31 +01:00
Tom Hughes
b96f3867e6 Allow OAuth 2 authorizations to redirect to anywhere 2021-05-18 12:12:36 +01:00