diff --git a/Gemfile.lock b/Gemfile.lock index c2952a85b96..05da11c4993 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -455,16 +455,16 @@ GEM rspec-core (>= 2.14) rtlcss (0.2.1) mini_racer (>= 0.6.3) - rubocop (1.68.0) + rubocop (1.69.0) json (~> 2.3) language_server-protocol (>= 3.17.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.4, < 3.0) - rubocop-ast (>= 1.32.2, < 2.0) + rubocop-ast (>= 1.36.1, < 2.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 2.4.0, < 3.0) + unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.36.1) parser (>= 3.3.1.0) rubocop-capybara (2.21.0) @@ -563,7 +563,9 @@ GEM uglifier (4.2.1) execjs (>= 0.3.0, < 3) unf (0.2.0) - unicode-display_width (2.6.0) + unicode-display_width (3.1.2) + unicode-emoji (~> 4.0, >= 4.0.4) + unicode-emoji (4.0.4) unicorn (6.1.0) kgio (~> 2.6) raindrops (~> 0.7) diff --git a/app/models/concerns/second_factor_manager.rb b/app/models/concerns/second_factor_manager.rb index 0477bc54e19..70d3a1dcecf 100644 --- a/app/models/concerns/second_factor_manager.rb +++ b/app/models/concerns/second_factor_manager.rb @@ -38,7 +38,7 @@ module SecondFactorManager end def authenticate_totp(token) - totps = self&.user_second_factors&.totps + totps = self.user_second_factors&.totps authenticated = false totps.each do |totp| last_used = 0 @@ -64,18 +64,18 @@ module SecondFactorManager def totp_enabled? !SiteSetting.enable_discourse_connect && SiteSetting.enable_local_logins && - self&.user_second_factors&.totps&.exists? + self.user_second_factors&.totps&.exists? end def backup_codes_enabled? !SiteSetting.enable_discourse_connect && SiteSetting.enable_local_logins && - self&.user_second_factors&.backup_codes&.exists? + self.user_second_factors&.backup_codes&.exists? end def security_keys_enabled? !SiteSetting.enable_discourse_connect && SiteSetting.enable_local_logins && self - &.security_keys + .security_keys &.where(factor_type: UserSecurityKey.factor_types[:second_factor], enabled: true) &.exists? end @@ -101,7 +101,7 @@ module SecondFactorManager end def remaining_backup_codes - self&.user_second_factors&.backup_codes&.count + self.user_second_factors&.backup_codes&.count end def authenticate_second_factor(params, secure_session) @@ -244,7 +244,7 @@ module SecondFactorManager def authenticate_backup_code(backup_code) if !backup_code.blank? - codes = self&.user_second_factors&.backup_codes + codes = self.user_second_factors&.backup_codes codes.each do |code| parsed_data = JSON.parse(code.data)