Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LG-15248: Account Management no change available #11701

Open
wants to merge 49 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
a189173
add requested attribute to accounts_show_presenter
jmdembe Jan 2, 2025
4020197
add logic for decorated_sp_session
jmdembe Jan 3, 2025
ee0db90
check for requested_attributes and ial2_requested
jmdembe Jan 3, 2025
e8be3a9
add tests for requested attribes and ial2 requested
jmdembe Jan 3, 2025
86d6926
changelog: User-Facing Improvements, account management, no change av…
jmdembe Jan 3, 2025
934f0de
add logic to show/hide change button
jmdembe Jan 3, 2025
74facb5
clean up controller and presenter
jmdembe Jan 3, 2025
591fc76
clean up requested_attributes in the rest of controllers and specs
jmdembe Jan 3, 2025
4664686
change logic for all emails requested as well as `nil` to `false` in …
jmdembe Jan 3, 2025
26e8be3
remove `ial2_requested`
jmdembe Jan 3, 2025
02d8719
lintfix
jmdembe Jan 6, 2025
5eefe8c
fix logic to show desired behavior when is false
jmdembe Jan 6, 2025
0134622
remove debugger
jmdembe Jan 6, 2025
997aeb8
fix logic
jmdembe Jan 6, 2025
b16e7da
add supporting test for view
jmdembe Jan 6, 2025
534f517
match `all_emails_requested` to be a boolean value
jmdembe Jan 6, 2025
761bfcc
add logic for if the partner does not have `email` as a consented att…
jmdembe Jan 6, 2025
f3f21d7
logic change to `all_emails_requested?`
jmdembe Jan 6, 2025
108fd92
refine check for no email (WIP), refine method name
jmdembe Jan 7, 2025
eb25134
fix all broken tests
jmdembe Jan 8, 2025
884b507
change service provider -> partner
jmdembe Jan 8, 2025
bc696dd
more logic correction
jmdembe Jan 8, 2025
5bc8280
rename and fix logic
jmdembe Jan 9, 2025
36b18ad
Update app/controllers/accounts/connected_accounts_controller.rb
jmdembe Jan 10, 2025
5986f27
change `all_emails requested` -> `change_email_available?`
jmdembe Jan 10, 2025
34a73c4
Merge branch 'main' into jd-LG-15248-hide-change-button
jmdembe Jan 10, 2025
5b8bd55
remove `change_email_available`
jmdembe Jan 14, 2025
d17800e
move logic around
jmdembe Jan 15, 2025
c7ca2fd
logic in presenter and view
jmdembe Jan 15, 2025
7a3c016
change to `change_option_available`, fix test
jmdembe Jan 16, 2025
360e683
edit test block
jmdembe Jan 16, 2025
8536784
change name to be more intuitive
jmdembe Jan 16, 2025
ff437fc
add tests to view
jmdembe Jan 16, 2025
586055d
fix account show presenter tests
jmdembe Jan 16, 2025
64245bc
method name cleanup
jmdembe Jan 16, 2025
0a8ad18
more test fixes
jmdembe Jan 17, 2025
ecc1bbf
more changes
jmdembe Jan 17, 2025
6662324
fix eager loading problem
jmdembe Jan 17, 2025
6d6a698
lintfix
jmdembe Jan 17, 2025
daa3494
add test
jmdembe Jan 17, 2025
e5e7cf0
test 1 for connected apps
jmdembe Jan 21, 2025
17b9533
check against `identities` and pass value
jmdembe Jan 24, 2025
ee31f5f
place logic in model, remove logic from presenter and controller, add…
jmdembe Jan 24, 2025
52e9bac
no longer doing logic in controller, so return connected apps to prev…
jmdembe Jan 24, 2025
4e48813
remove `requested_attributes`
jmdembe Jan 24, 2025
c678113
fix logic in model and view
jmdembe Jan 24, 2025
775091d
method name change
jmdembe Jan 24, 2025
ca2d8e3
remove unneeded keyword
jmdembe Jan 24, 2025
849bfb8
fix tests
jmdembe Jan 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove ial2_requested
jmdembe committed Jan 3, 2025
commit 26e8be3612eb88082c0d658dbac98c599c7d19c9
1 change: 0 additions & 1 deletion app/controllers/accounts/connected_accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ def show
user: current_user,
locked_for_session: pii_locked_for_session?(current_user),
all_emails_requested: all_emails_requested?,
ial2_requested: ial2_requested?,
)
end

1 change: 0 additions & 1 deletion app/controllers/accounts/history_controller.rb
Original file line number Diff line number Diff line change
@@ -16,7 +16,6 @@ def show
user: current_user,
locked_for_session: pii_locked_for_session?(current_user),
all_emails_requested: nil,
ial2_requested: nil,
)
end
end
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ def show
user: current_user,
locked_for_session: pii_locked_for_session?(current_user),
all_emails_requested: nil,
ial2_requested: nil,
)
end
end
1 change: 0 additions & 1 deletion app/controllers/accounts_controller.rb
Original file line number Diff line number Diff line change
@@ -19,7 +19,6 @@ def show
user: current_user,
locked_for_session: pii_locked_for_session?(current_user),
all_emails_requested: nil,
ial2_requested: nil,
)
if session.delete(:from_select_email_flow)
flash.now[:success] = t(
1 change: 0 additions & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
@@ -17,7 +17,6 @@ def show
user: current_user,
locked_for_session: pii_locked_for_session?(current_user),
all_emails_requested: nil,
ial2_requested: nil,
)
device_and_events
rescue ActiveRecord::RecordNotFound, ActiveModel::RangeError
43 changes: 1 addition & 42 deletions app/presenters/account_show_presenter.rb
Original file line number Diff line number Diff line change
@@ -9,26 +9,6 @@ class AccountShowPresenter
:authn_context,
:sp_name

SORTED_IAL2_ATTRIBUTE_MAPPING = [
[[:email], :email],
[[:all_emails], :all_emails],
[%i[given_name family_name], :full_name],
[[:address], :address],
[[:phone], :phone],
[[:birthdate], :birthdate],
[[:social_security_number], :social_security_number],
[[:x509_subject], :x509_subject],
[[:x509_issuer], :x509_issuer],
[[:verified_at], :verified_at],
].freeze

SORTED_IAL1_ATTRIBUTE_MAPPING = [
[[:email], :email],
[[:all_emails], :all_emails],
[[:x509_subject], :x509_subject],
[[:x509_issuer], :x509_issuer],
[[:verified_at], :verified_at],
].freeze
delegate :identity_verified_with_facial_match?, to: :user

def initialize(
@@ -38,8 +18,7 @@ def initialize(
sp_name:,
user:,
locked_for_session:,
all_emails_requested:,
ial2_requested:
all_emails_requested:
)
@decrypted_pii = decrypted_pii
@user = user
@@ -49,7 +28,6 @@ def initialize(
@locked_for_session = locked_for_session
@all_emails_requested = all_emails_requested
@pii = determine_pii
@ial2_requested = ial2_requested
end

def show_password_reset_partial?
@@ -159,10 +137,6 @@ def connected_apps
user.connected_apps.includes([:service_provider_record, :email_address])
end

def ial2_requested?
@ial2_requested
end

def show_change_option
jmdembe marked this conversation as resolved.
Show resolved Hide resolved
@all_emails_requested
end
@@ -219,19 +193,4 @@ def determine_pii
obfuscated_pii_accessor
end
end

def displayable_attribute_keys
sorted_attribute_mapping = if ial2_requested?
SORTED_IAL2_ATTRIBUTE_MAPPING
else
SORTED_IAL1_ATTRIBUTE_MAPPING
end

sorted_attributes = sorted_attribute_mapping.map do |raw_attribute, display_attribute|
display_attribute if (requested_attributes & raw_attribute).present?
end
# If the SP requests all emails, do not show
sorted_attributes.delete(:email) if sorted_attributes.include?(:all_emails)
sorted_attributes.compact
end
end
2 changes: 0 additions & 2 deletions spec/controllers/accounts_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -135,7 +135,6 @@
user: user,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)
allow(subject).to receive(:presenter).and_return(presenter)

@@ -175,7 +174,6 @@
user: user,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)
allow(subject).to receive(:presenter).and_return(presenter)

12 changes: 0 additions & 12 deletions spec/presenters/account_show_presenter_spec.rb
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@
user:,
locked_for_session:,
all_emails_requested: false,
ial2_requested: nil,
)
end

@@ -297,7 +296,6 @@
user: user,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(account_show.pending_ipp?).to be(false)
@@ -332,7 +330,6 @@
user: user,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(account_show.pending_ipp?).to be(false)
@@ -461,7 +458,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(profile_index.header_personalization).to eq first_name
@@ -481,7 +477,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(profile_index.header_personalization).to eq email_address.email
@@ -505,7 +500,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(profile_index.totp_content).to eq t('account.index.auth_app_enabled')
@@ -526,7 +520,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(profile_index.totp_content).to eq t('account.index.auth_app_disabled')
@@ -565,7 +558,6 @@
user: user.reload,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(account_show.backup_codes_generated_at).to be_within(
@@ -586,7 +578,6 @@
user: user.reload,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(account_show.backup_codes_generated_at).to be_nil
@@ -636,7 +627,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(
@@ -662,7 +652,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(
@@ -683,7 +672,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)

expect(profile_index.personal_key_generated_at).to be_nil
1 change: 0 additions & 1 deletion spec/views/accounts/_badges.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
user:,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)
end

Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@
user:,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
)
end

Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end
1 change: 0 additions & 1 deletion spec/views/accounts/history/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end
2 changes: 0 additions & 2 deletions spec/views/accounts/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -25,7 +25,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end
@@ -258,7 +257,6 @@
sp_name: sp.friendly_name,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end
@@ -43,7 +42,6 @@
sp_name: nil,
locked_for_session: false,
all_emails_requested: false,
ial2_requested: false,
),
)
end