Me/dpc 5451 last used csp indicator#3015
Conversation
| echo "└────────────────────────-----───┘" | ||
|
|
||
| docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml run --entrypoint "bundle exec rubocop" dpc_portal | ||
| docker compose -p start-v1-portals -f docker-compose.yml -f docker-compose.portals.yml run --entrypoint "rails assets:clobber tmp:clear" dpc_portal |
There was a problem hiding this comment.
I added this because the asset cache isn't getting rebuilt between CI runs on our code builders, and it causes tests to fail whenever we need to add an image somewhere. This forces it in CI.
| <%= button_to @login_path, class: 'usa-button width-full margin-bottom-1', data: { turbo: false } do %> | ||
| <span class="clear-login-button__logo">CLEAR</span> | ||
| <% end %> | ||
| <% if @last_used_csp == :clear%> |
There was a problem hiding this comment.
I think it would be good to avoid conditionals for both opening and closing <div> tags. New component isn't required, but I'm almost certain you can achieve what you want by conditionally applying the class here
e.g.
<%= idp_login_button login_path, is_last_used, ... %>
then the idp_login_button includes
<div <% if is_last_used %>class="last-used-login-wrapper margin-bottom-1"<% endif %> >
<%= button_to @login_path, class: 'usa-button width-full margin-bottom-1', data: { turbo: false } do %>
<span class="{{ csp }}-login-button__logo">{{ csp }}</span>
</div>
There was a problem hiding this comment.
That code was kind of ugly, and your suggestion was a good idea that sent me down a rabbit hole trying to see how clean and streamlined I could make this bit of code.
| expect(page).not_to have_css('.last-used-login-wrapper .lg-login-button__logo') | ||
| end | ||
| end | ||
| end |
|
Hey @MEspositoE14s, I tried testing your changes locally but I am getting this message from what looks like a comment. i think you can use either html comment |
Doh! I added this in the last commit and it was a total brain fart on my part. This is what happens when you jump between languages too often 😞 |
No worries, that context switching can be brutal! |


🎫 Ticket
https://jira.cms.gov/browse/DPC-5451
🛠 Changes
ℹ️ Context
When a user comes back to our site, we want to highlight the CSP they last used to login.
On a successful login we write a cookie named
last_used_csp. If that cookie is present when the user returns to the login page, we use it to highlight the CSP as "Last Used".🧪 Validation
Currently, only Login.gov is supported in the dpc-portal. If you want to see how the other CSPs look you have two options:
last_used_cspcookie.