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

(getgov-za) Ticket #2047: Force new users to finish setting up profile #2168

Open
wants to merge 69 commits into
base: main
Choose a base branch
from

Conversation

zandercymatics
Copy link
Contributor

@zandercymatics zandercymatics commented May 14, 2024

Ticket

Resolves #2047

Changes

  • Adds a finish profile setup page, as well as middleware logic to contain that. Interacts with the your profile page.

Context for reviewers

Note: This ticket requires #1807. The content of that PR is merged into this one.
This PR adds a "Finish profile setup" page for new users under two circumstances:

  1. When the incoming user is a "new" user (i.e. their user account was just created in our DB) so they can review their information. This is because OIDC doesn't give us all the information we need.
  2. When an existing user is missing information such as their title or phone number

In addition, this PR is intended to redirect the user to their original, desired destination. This means that if the user clicks the "start your domain request" button on get.gov, they will be redirect to the start a new domain request page. Otherwise, they'll be redirected to home. For now, just domain request and home are supported as design would want custom content for other pages if it becomes something we want to consider.

It is toggleable with the profile_feature waffle flag in Django Admin. This is off by default so set it to everyone.

Setup

  1. Login as a super user, and navigate to /admin
  2. Go to the users table
  3. Find your user record in the table, and edit it. Blank out a field. I suggest the title field, but you can test others.
  4. Go to the waffle flag table and click the "profile_feature" record
  5. Modify the waffle flag such that the "everyone" field is set to yes
  6. At this point, you should be redirect to the setup page. Try triggering error conditions, adding field values, removing them. Etc.
  7. After you save, click the "Back to manage your domains" button
  8. Go to /admin
  9. While logged in as a superuser, click the users table and click the corresponding record for your analyst account
  10. Blank out a field as before
  11. Open a new window (or browser) that is not logged into login.gov
  12. Navigate to https://getgov-za.app.cloud.gov/request/ (or if your testing locally, localhost:8080/request)
  13. Login with your analyst account
  14. Save as normal. At the end, you should be redirected to the domain request page. You should no longer see the "Back to manage your domains" button and instead a continue button next to the save button

Code Review Verification Steps

As the original developer, I have

Satisfied acceptance criteria and met development standards

  • Met the acceptance criteria, or will meet them in a subsequent PR
  • Created/modified automated tests
  • Added at least 2 developers as PR reviewers (only 1 will need to approve)
  • Messaged on Slack or in standup to notify the team that a PR is ready for review
  • Changes to “how we do things” are documented in READMEs and or onboarding guide
  • If any model was updated to modify/add/delete columns, makemigrations was ran and the associated migrations file has been commited.

Ensured code standards are met (Original Developer)

  • All new functions and methods are commented using plain language
  • Did dependency updates in Pipfile also get changed in requirements.txt?
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values

Validated user-facing changes (if applicable)

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing
  • Checked keyboard navigability
  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)
  • Add at least 1 designer as PR reviewer

As a code reviewer, I have

Reviewed, tested, and left feedback about the changes

  • Pulled this branch locally and tested it
  • Reviewed this code and left comments
  • Checked that all code is adequately covered by tests
  • Made it clear which comments need to be addressed before this work is merged
  • If any model was updated to modify/add/delete columns, makemigrations was ran and the associated migrations file has been commited.

Ensured code standards are met (Code reviewer)

  • All new functions and methods are commented using plain language
  • Interactions with external systems are wrapped in try/except
  • Error handling exists for unusual or missing values
  • (Rarely needed) Did dependency updates in Pipfile also get changed in requirements.txt?

Validated user-facing changes as a developer

  • New pages have been added to .pa11yci file so that they will be tested with our automated accessibility testing

  • Checked keyboard navigability

  • Meets all designs and user flows provided by design/product

  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)

  • Tested with multiple browsers, the suggestion is to use ones that the developer didn't (check off which ones were used)

    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

Note: Multiple code reviewers can share the checklists above, a second reviewers should not make a duplicate checklist

As a designer reviewer, I have

Verified that the changes match the design intention

  • Checked that the design translated visually
  • Checked behavior
  • Checked different states (empty, one, some, error)
  • Checked for landmarks, page heading structure, and links
  • Tried to break the intended flow

Validated user-facing changes as a designer

  • Checked keyboard navigability

  • Tested general usability, landmarks, page header structure, and links with a screen reader (such as Voiceover or ANDI)

  • Tested with multiple browsers (check off which ones were used)

    • Chrome
    • Microsoft Edge
    • FireFox
    • Safari
  • (Rarely needed) Tested as both an analyst and applicant user

Screenshots

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

function showInputOnErrorFields(){
document.addEventListener('DOMContentLoaded', function() {
// Get all input elements within the form
let form = document.querySelector("#finish-profile-setup-form");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is using an ID because of where it is in the DOM. Its more reliable this way and less reliant on either an underyling object or otherwise - and it ensures this code doesn't get run elsewhere

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.


# In some cases, we don't want to redirect to home. This handles that.
# Can easily be generalized if need be, but for now lets keep this easy to read.
custom_redirect = "domain-request:" if request.path == "/request/" else None
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This coerces the request path to a given viewname.
Basically, the point is that it gives us a mapping that we have direct control over rather than just blindly accepting all input. If we need to change this we can, but I advocate to keep the scope of change small until we determine we need more functionality

Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@zandercymatics zandercymatics changed the title (Requires ticket #1807) Ticket #2047: Force new users to finish setting up profile Ticket #2047: Force new users to finish setting up profile May 28, 2024
@zandercymatics zandercymatics changed the title Ticket #2047: Force new users to finish setting up profile (getgov-za) Ticket #2047: Force new users to finish setting up profile May 28, 2024
@zandercymatics zandercymatics requested review from Katherine-Osos and a team May 28, 2024 20:20
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@gabydisarli gabydisarli self-requested a review May 29, 2024 15:04
Copy link

🥳 Successfully deployed to developer sandbox za.

1 similar comment
Copy link

🥳 Successfully deployed to developer sandbox za.

Copy link

🥳 Successfully deployed to developer sandbox za.

@CocoByte CocoByte self-assigned this May 30, 2024
Copy link

🥳 Successfully deployed to developer sandbox za.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Force new users to finish setting up their profile
2 participants