Replace setting with a configuration variable

pull/4743/head
Oliver Günther 8 years ago
parent 97678334ee
commit 3f4388816e
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 3
      app/controllers/concerns/password_confirmation.rb
  2. 6
      app/views/settings/_authentication.html.erb
  3. 5
      config/locales/en.yml
  4. 3
      config/settings.yml
  5. 1
      lib/open_project/configuration.rb
  6. 7
      spec/features/users/my_spec.rb

@ -45,6 +45,7 @@ module Concerns::PasswordConfirmation
# Returns whether password confirmation has been enabled globally
# AND the current user is internally authenticated.
def password_confirmation_required?
Setting.internal_password_confirmation? && !User.current.uses_external_authentication?
OpenProject::Configuration.internal_password_confirmation? &&
!User.current.uses_external_authentication?
end
end

@ -57,12 +57,6 @@ See doc/COPYRIGHT.rdoc for more details.
</div>
<div class="form--field"><%= setting_text_field :password_count_former_banned, size: 6 %></div>
<div class="form--field"><%= setting_check_box :lost_password, label: :label_password_lost %></div>
<div class="form--field">
<%= setting_check_box :internal_password_confirmation %>
<span class="form--field-instructions">
<%= simple_format t('settings.instructions.internal_password_confirmation') %>
</span>
</div>
<% else %>
<div class="form--field">
<label><%= I18n.t :note %></label>

@ -1716,7 +1716,6 @@ en:
setting_gravatar_default: "Default Gravatar image"
setting_gravatar_enabled: "Use Gravatar user icons"
setting_host_name: "Host name"
setting_internal_password_confirmation: "Password confirmation for account changes"
setting_work_package_done_ratio: "Calculate the work package done ratio with"
setting_work_package_done_ratio_field: "Use the work package field"
setting_work_package_done_ratio_status: "Use the work package status"
@ -1782,10 +1781,6 @@ en:
passwords: "Passwords"
session: "Session"
brute_force_prevention: "Automated user blocking"
instructions:
internal_password_confirmation: |
Require internally authenticated users to confirm their password upon changing their own account details (e.g., their email address).
Note: Even when checking this option, externally authenticated users do not have a password and will not be prompted on account changes.
show_hide_project_menu: "Expand/Collapse project menu"

@ -332,6 +332,3 @@ repository_checkout_data:
api_max_page_size:
format: int
default: 500
internal_password_confirmation:
format: boolean
default: 1

@ -77,6 +77,7 @@ module OpenProject
'disable_password_login' => false,
'omniauth_direct_login_provider' => nil,
'internal_password_confirmation' => true,
'disable_password_choice' => false,

@ -36,8 +36,7 @@ describe 'my', type: :feature, js: true do
mail: 'old@mail.com',
login: 'bob',
password: user_password,
password_confirmation: user_password
)
password_confirmation: user_password)
end
##
@ -68,14 +67,14 @@ describe 'my', type: :feature, js: true do
end
context 'when confirmation disabled',
with_settings: { internal_password_confirmation?: false } do
with_config: { internal_password_confirmation: false } do
it 'does not request confirmation' do
expect_changed!
end
end
context 'when confirmation required',
with_settings: { internal_password_confirmation?: true } do
with_config: { internal_password_confirmation: true } do
it 'requires the password for a regular user' do
dialog.confirm_flow_with(user_password)
expect_changed!

Loading…
Cancel
Save