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

feat: DAH-2876 useRedirect for authenticated pages #2488

Closed
wants to merge 62 commits into from

Conversation

cade-exygy
Copy link
Collaborator

Description

If a user tries to go to the my-account, account-settings, or my-applications and is not signed in: redirect to sign in page, show banner. Once the login happens, the user is redirected to the page they were trying to access prior.

Jira ticket

https://sfgovdt.jira.com/browse/DAH-2876

Checklist before requesting review

Version Control

  • branch name begins with angular if it contains updates to Angular code
  • branch name contains the Jira ticket number
  • PR name follows type: TICKET-NUMBER Description format, e.g. feat: DAH-123 New Feature

Code quality

  • the set of changes is small
  • all automated code checks pass (linting, tests, coverage, etc.)
  • code irrelevant to the ticket is not modified e.g. changing indentation due to automated formatting
  • if the code changes the UI, it matches the UI design exactly
  • if the changes include human translations, follow the human translations process

Review instructions

  • instructions specify which environment(s) it applies to
  • instructions work for PA testers
  • instructions have already been performed at least once

Request review

  • PR has needs review label
  • Use Housing Eng group to automatically assign reviewers, and/or assign specific engineers
  • If time sensitive, notify engineers in Slack

Review Instructions

  • On the review app:
  • While signed out, manually enter the restricted url: /my-account?react=true
  • It should try to load the page, but then redirect back to /sign-in
  • You should see the banner
  • Sign In to an account: [email protected] / test1234
  • Once you are signed in, you should be redirected
  • Try this with /my-account, /account-settings, and /my-applications

Test edge cases like signing out, triggering other banners, etc

@cade-exygy cade-exygy added the needs review Pull request needs review label Jan 7, 2025
@hshaosf hshaosf temporarily deployed to dahlia-webapp-pr-2488 January 7, 2025 20:07 Inactive
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 January 8, 2025 16:00 Inactive
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 January 8, 2025 17:11 Inactive
app/javascript/pages/account/my-applications.tsx Outdated Show resolved Hide resolved
app/javascript/hooks/useRedirect.tsx Outdated Show resolved Hide resolved
app/javascript/pages/account/account-settings.tsx Outdated Show resolved Hide resolved
Copy link
Collaborator

@jimlin-sfgov jimlin-sfgov left a comment

Choose a reason for hiding this comment

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

these are just about coverage

app/javascript/hooks/useRedirect.tsx Outdated Show resolved Hide resolved

export const getSignInRedirectUrl = (redirect: string) => {
return getRedirectUrl(redirect || "account")
}
Copy link
Collaborator

@jimlin-sfgov jimlin-sfgov Jan 14, 2025

Choose a reason for hiding this comment

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

issue: Add tests for new functions in routeUtil.test.ts

app/javascript/authentication/SignInForm.tsx Outdated Show resolved Hide resolved
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 January 23, 2025 20:47 Inactive
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 January 23, 2025 21:22 Inactive
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 January 31, 2025 17:57 Inactive
Copy link
Contributor

@tallulahkay tallulahkay left a comment

Choose a reason for hiding this comment

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

I tried to review this, but I'm still not seeing the banner pop up on the sign in page when i type in my-account?react=true

@jimlin-sfgov
Copy link
Collaborator

I don't see the banner when following the review instructions in the review app or locally. @cade-exygy did you run through your review instructions before requesting review?

@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 February 3, 2025 18:50 Inactive
@cade-exygy
Copy link
Collaborator Author

I don't see the banner when following the review instructions in the review app or locally. @cade-exygy did you run through your review instructions before requesting review?

@tallulahkay @jimlin-sfgov Added back the banner. FYI, the main changes here is the redirect logic, so looking for a review on that behavior.

Copy link
Contributor

@tallulahkay tallulahkay left a comment

Choose a reason for hiding this comment

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

Nice!

@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 February 3, 2025 19:09 Inactive
cliu02 and others added 28 commits February 6, 2025 17:16
* feat: DAH-3077 hide lottery prefs

* feat: remove preferences section

* fix: merge conflict

* fix: controller

* fix: ng-if function

* test: update test

---------

Co-authored-by: tallulah <[email protected]>
…2510)

fix: handle invalid listings when logging translation usage
* feat: remove back link on DALP listings

* fix: try to address create account rtl failures

* fix: remove test fix
* feat: DAH-3110 make enter submit

* fix: DAH-3110 remove unnecessary changes

* test: DAH-3110 add tests

* test: DAH-3110 update snapshots

* fix: DAH-3110 fix conflicting variable naming

---------

Co-authored-by: Jim Lin <[email protected]>
…2517)

* feat: DAH-3090 conditional check box review on dalp

* feat: DAH-3090 dalp qualify conditional language

* fix: DAH-3090 fix translations order

* fix: DAH-3090 remove unneeded change
* feat: Analytics for log in and log out

* fix: tests

* test: improve test coverage

* fix: fix some pr issues
* feat: add dalp check

* fix: update check

* fix: update check
feat: add dalp priority to conf page
* fix: DAH-2866 fix formatting

* fix: DAH-2866 fix in mobile
* feat: DAH-3084 confirmation page DALP

* fix: DAH-3084 remove unneeded translation key

* fix: DAH-3084 remove padding

* fix: DAH-3084 link styling
* feat: DAH-3169 default to sf gov listing

* test: DAH-3169 add test coverage

* fix: DAH-3169 add localization to urls

* fix: DAH-3169 try updating orb

* test: DAH-3169 update e2e test

* fix: DAH-3169 flip logic

* test: DAH-3169 add existence check
* feat: DAH-3132 Update icon

* fix: DAH-3132 fix debugging code
* feat: update dalp confirmation email

* test: DAH-3085 fix test

* feat: DAH-3085 add datetime

* fix: DAH-3085 fix order of translations

* test: DAH-3085 add test coverage

* fix: DAH-3085 fix date string

* fix: DAH-3085 a couple of formatting changes

* test: DAH-3085 fix tests
* fix: DAH-3191 fix email address for lottery appeals

* fix: DAH-3191 fix order of translations
* feat: add script

* fix: sync with sforce
@cade-exygy cade-exygy temporarily deployed to dahlia-webapp-pr-2488 February 6, 2025 23:19 Inactive
@cade-exygy cade-exygy closed this Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review Pull request needs review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants