Skip to content

Commit 9448e4d

Browse files
Release OpenProject 16.6.2
2 parents f76b26a + 4df4183 commit 9448e4d

62 files changed

Lines changed: 810 additions & 92 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ GIT
3636

3737
GIT
3838
remote: https://github.com/opf/omniauth-openid-connect.git
39-
revision: e923d9dd14fa4ca04b98720ac2185807b263f5ed
40-
ref: e923d9dd14fa4ca04b98720ac2185807b263f5ed
39+
revision: f0c1ecdb26e39017a9e929af75a166c772d960bb
40+
ref: f0c1ecdb26e39017a9e929af75a166c772d960bb
4141
specs:
42-
omniauth-openid-connect (0.4.1)
42+
omniauth-openid-connect (0.4.2)
4343
addressable (~> 2.5)
4444
omniauth (~> 1.6)
4545
openid_connect (~> 2.2.0)
@@ -2003,7 +2003,7 @@ CHECKSUMS
20032003
oj (3.16.11) sha256=2aab609d2bc896529bd3c70d737f591c13932a640ba6164a0f7e414efdb052b1
20042004
okcomputer (1.19.0) sha256=8548935a82f725bdd8f2c329925a9f1a1bb2ce19ce26b47d7515665ee363b458
20052005
omniauth (1.9.2)
2006-
omniauth-openid-connect (0.4.1)
2006+
omniauth-openid-connect (0.4.2)
20072007
omniauth-openid_connect-providers (0.2.0)
20082008
omniauth-saml (1.10.6) sha256=13dde22f4fd1beff0ef2d6dae576f7b68594f159990e8e886d8a02b32397afbd
20092009
op-clamav-client (3.4.2) sha256=f28d697d11758a2ba3dc530cfdf4871a00ecd517631e8bac30dee30cd6012964

Gemfile.modules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ gem 'omniauth-openid_connect-providers',
88

99
gem 'omniauth-openid-connect',
1010
git: 'https://github.com/opf/omniauth-openid-connect.git',
11-
ref: 'e923d9dd14fa4ca04b98720ac2185807b263f5ed'
11+
ref: 'f0c1ecdb26e39017a9e929af75a166c772d960bb'
1212

1313
group :opf_plugins do
1414
# included so that engines can reference OpenProject::Version

app/controllers/account_controller.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ def activate
182182
# to change the password.
183183
# When making changes here, also check MyController.change_password
184184
def change_password
185-
# Retrieve user_id from session
186-
@user = User.find(params[:password_change_user_id])
185+
# Retrieve user login name from session
186+
@user = User.find_by!(login: params[:password_change_user])
187187

188188
change_password_flow(user: @user, params:, show_user_name: true) do
189189
password_authentication(@user.login, params[:new_password])
190190
end
191191
rescue ActiveRecord::RecordNotFound
192-
Rails.logger.error "Failed to find user for change_password request: #{flash[:_password_change_user_id]}"
192+
Rails.logger.error "Failed to find user for change_password request: #{flash[:_password_change_user]}"
193193
render_404
194194
end
195195

app/controllers/concerns/accounts/user_password_change.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ def change_password_flow(user:, params:, update_legacy: true, show_user_name: fa
4242
# auth sources in the admin UI, so this shouldn't normally happen.
4343
return if redirect_if_password_change_not_allowed(user)
4444

45+
# Check if user is locked due to too many failed attempts
46+
if user.failed_too_many_recent_login_attempts?
47+
flash_and_log_invalid_credentials(is_logged_in: !show_user_name)
48+
return render_password_change(user, nil, show_user_name:)
49+
end
50+
4551
# Ensure the current password is validated
4652
unless user.check_password?(params[:password], update_legacy:)
53+
user.log_failed_login
4754
flash_and_log_invalid_credentials(is_logged_in: !show_user_name)
4855
return render_password_change(user, nil, show_user_name:)
4956
end
@@ -53,6 +60,9 @@ def change_password_flow(user:, params:, update_legacy: true, show_user_name: fa
5360

5461
# Yield the success to the caller
5562
if call.success?
63+
# Reset failed login count on successful password change
64+
User.reset_failed_login_count_for(user)
65+
5666
response = yield call
5767

5868
call.apply_flash_message!(flash)

app/models/principals/scopes/visible.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ module Visible
3939
class_methods do
4040
def visible(user = ::User.current)
4141
if user.allowed_in_any_project?(:manage_members) ||
42-
user.allowed_globally?(:manage_user) ||
43-
user.allowed_in_any_project?(:share_work_packages)
42+
user.allowed_globally?(:manage_user) ||
43+
user.allowed_in_any_project?(:share_work_packages)
4444
all
4545
else
4646
in_visible_project_or_me(user)

app/models/setting.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#++
3030

3131
class Setting < ApplicationRecord
32+
class NotWritableError < StandardError; end
33+
3234
extend Aliases
3335
extend MailSettings
3436

@@ -174,7 +176,7 @@ def value=(val)
174176

175177
def set_value!(val, force: false)
176178
unless force || definition.writable?
177-
raise NoMethodError, "#{name} is not writable but can be set through env vars or configuration.yml file."
179+
raise NotWritableError, "#{name} is not writable but can be set through env vars or configuration.yml file."
178180
end
179181

180182
self[:value] = formatted_value(val)

app/services/settings/update_service.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ def initialize(user:)
3737
def persist(call)
3838
params.each do |name, value|
3939
set_setting_value(name, value)
40+
rescue Setting::NotWritableError
41+
i18n_name = I18n.t("setting_#{name}", default: name)
42+
call.success = false
43+
call.errors.add(:base, I18n.t("settings.errors.failed_to_update",
44+
message: I18n.t("settings.errors.not_writable"),
45+
name: i18n_name))
4046
end
47+
4148
call
4249
end
4350

app/views/admin/settings/mail_notifications_settings/show.html.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ See COPYRIGHT and LICENSE files for more details.
8787
</div>
8888
<div id="email_delivery_method_sendmail" class="email_delivery_method_settings">
8989
<div class="form--field"><%= setting_text_field :sendmail_location %></div>
90+
<div class="form--field"><%= setting_text_field :sendmail_arguments %></div>
9091
</div>
9192
<div id="email_delivery_method_letter_opener" class="email_delivery_method_settings">
9293
<p>Letter opener is used to render emails as a file in your Rails tmp folder. Mails will automatically open in

app/views/my/password.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ See COPYRIGHT and LICENSE files for more details.
4444
{ autocomplete: "off", class: "form -wide-labels" }
4545
) do %>
4646
<%= back_url_hidden_field_tag %>
47-
<%= hidden_field_tag :password_change_user_id, @user.id %>
47+
<%= hidden_field_tag :password_change_user, @user.login %>
4848
<section class="form--section">
4949
<%= render partial: "my/password_form_fields",
5050
locals: { show_user_name: !!(defined? show_user_name) ? show_user_name : nil,

config/constants/settings/definition.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1010,11 +1010,13 @@ class Definition
10101010
sendmail_arguments: {
10111011
description: "Arguments to call sendmail with in case it is configured as outgoing email setup",
10121012
format: :string,
1013+
writable: false,
10131014
default: "-i"
10141015
},
10151016
sendmail_location: {
10161017
description: "Location of sendmail to call if it is configured as outgoing email setup",
10171018
format: :string,
1019+
writable: false,
10181020
default: "/usr/sbin/sendmail"
10191021
},
10201022
# Allow separate error reporting for frontend errors

0 commit comments

Comments
 (0)