OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Adapt admin spec
Oliver Günther1d0ea180f0a2
diff --git a/app/views/admin/settings/authentication_settings/_passwords.html.erb b/app/views/admin/settings/authentication_settings/_passwords.html.erbindex dae58d29346..22e4c01f565 100644--- a/app/views/admin/settings/authentication_settings/_passwords.html.erb+++ b/app/views/admin/settings/authentication_settings/_passwords.html.erb@@ -57,9 +57,14 @@ See COPYRIGHT and LICENSE files for more details.min: 1,input_width: :small- form.check_box_group(disabled:, label: I18n.t(:setting_password_active_rules)) do |group|- OpenProject::Passwords::Evaluator.known_rules.each do |rule|- group.check_box(name: "password_active_rule[]", label: I18n.t("label_password_rule_#{rule}"))+ form.check_box_group(name: :password_active_rules,+ disabled:,+ label: I18n.t(:setting_password_active_rules)) do |group|+ OpenProject::Passwords::Evaluator.known_rules.each do |value|+ group.check_box(value:,+ label: I18n.t("label_password_rule_#{value}"),+ checked: OpenProject::Passwords::Evaluator.active_rule?(value),+ )endend@@ -68,6 +73,7 @@ See COPYRIGHT and LICENSE files for more details.disabled:,size: 6,min: 0,+ max: 4,input_width: :small)form.text_field(name: :password_days_valid,@@ -104,6 +110,8 @@ See COPYRIGHT and LICENSE files for more details.caption: I18n.t(:text_hint_disable_with_0),trailing_visual: { text: { text: I18n.t(:label_minute_plural) } },input_width: :small)++ form.submitendend%>diff --git a/lib/open_project/passwords.rb b/lib/open_project/passwords.rbindex df62e3a6a75..40602b1a7ef 100644--- a/lib/open_project/passwords.rb+++ b/lib/open_project/passwords.rb@@ -73,6 +73,10 @@ module OpenProjectSetting.password_active_rulesend+ def self.active_rule?(rule)+ Setting.password_active_rules.include?(rule.to_s)+ end+# Checks whether password adheres to complexity rules.# Does not check length.def self.password_conforms_to_rules(password)diff --git a/spec/features/users/password_change_spec.rb b/spec/features/users/password_change_spec.rbindex 652edbb4c32..38c6133bbc8 100644--- a/spec/features/users/password_change_spec.rb+++ b/spec/features/users/password_change_spec.rb@@ -113,23 +113,22 @@ RSpec.describe "random password generation", :js doendit "can configure and enforce password rules" do- visit admin_settings_authentication_path- expect_angular_frontend_initialized+ visit admin_settings_authentication_path(tab: :passwords)# Enforce rules# 3 of 'lowercase, uppercase, special'- find(".form--check-box[value=uppercase]").set true- find(".form--check-box[value=lowercase]").set true- find(".form--check-box[value=numeric]").set false- find(".form--check-box[value=special]").set true+ check "Lowercase"+ check "Uppercase"+ check "Special"+ uncheck "Numeric"# Set min length to 4- find_by_id("settings_password_min_length").set 4+ fill_in "Minimum length", with: 4# Set min classes to 3- find_by_id("settings_password_min_adhered_rules").set 3+ fill_in "Minimum number of required classes", with: 3- scroll_to_and_click(find(".button", text: "Save"))+ click_on "Save"expect_flash(message: "Successful update.")Setting.clear_cache