Conversation
app/presenters/two_factor_authentication/set_up_piv_cac_selection_presenter.rb
Outdated
Show resolved
Hide resolved
aduth
left a comment
There was a problem hiding this comment.
Can you rebase to resolve merge conflicts? I'll plan to give this a closer look shortly.
spec/presenters/two_factor_authentication/set_up_piv_cac_selection_presenter_spec.rb
Outdated
Show resolved
Hide resolved
spec/presenters/two_factor_authentication/set_up_piv_cac_selection_presenter_spec.rb
Show resolved
Hide resolved
| @@ -0,0 +1,6 @@ | |||
| module FederalEmailDomainHelper | |||
| def default_federal_domains | |||
There was a problem hiding this comment.
WDYT of naming this to indicate it has side effects?
| def default_federal_domains | |
| def set_up_default_federal_domains! |
aduth
left a comment
There was a problem hiding this comment.
Works well in testing. Left a few non-blocking comments, but LGTM otherwise 👍
| csv = CSV.parse(response.body, col_sep: ',', headers: true) | ||
| csv.each do |row| | ||
| FederalEmailDomain.find_or_create_by(name: row['Domain name']) | ||
| end |
There was a problem hiding this comment.
This is probably fine since we're only dealing with about 1400 entries, but I'd wonder if this should work a little more like the disposable emails task using insert_all. I think upsert_all could be an option too if we wanted to gracefully handle duplicates. I think the "find" element here is kinda wasted since we don't care to do anything with the result, so we could also just insert and rescue and discard on a ActiveRecord::RecordNotUnique exception.
If this was a bigger file, I'd also suggest using CSV.foreach instead of CSV.parse + Array#each, since it'd process row-by-row instead of loading the whole thing into memory first.
lib/tasks/federal_email_domains.rake
Outdated
| end | ||
| end | ||
| end | ||
| # rake "fed_email_domains:load_to_db" |
There was a problem hiding this comment.
| # rake "fed_email_domains:load_to_db" | |
| # rake "federal_email_domains:load_to_db" |
config/application.yml.default
Outdated
| skip_encryption_allowed_list: '["urn:gov:gsa:SAML:2.0.profiles:sp:sso:dev", "urn:gov:gsa:SAML:2.0.profiles:sp:sso:int"]' | ||
| state_tracking_enabled: false | ||
| telephony_adapter: pinpoint | ||
| use_fed_domain_class: false |
There was a problem hiding this comment.
Noting that this will cause an error if #11082 is merged before this. We could address the issue by only overriding where it's different from default.
🎫 Ticket
Link to the relevant ticket:
LG-13355
🛠 Summary of changes
This leverages using the Fed domain list to ensure we are only prompting users with Fed emails to add PIV or .mil users.
📜 Testing Plan
Provide a checklist of steps to confirm the changes.
ruby lib/fed_email_domain_downloader.rbto download the file locally. Move that file from tmp folder to fed_domain_emails folder. Or use the sample fed_email_domain sample file in the folder.fed_email_domain.txtand set use_fed_domain_file totrue