Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
4139552
fix(NewAccountWizard): Create an OtpUser entry when user clicks Next …
binh-dam-ibigroup Sep 1, 2020
7f1851b
refactor(UserAccountScreen): Update working copy of state.user on com…
binh-dam-ibigroup Sep 1, 2020
1907352
fix(FavoriteLocationsPane): Remove console warning regarding null <in…
binh-dam-ibigroup Sep 3, 2020
3100de8
fix(NotificationPrefsPane): Prepare UI support for phone verification.
binh-dam-ibigroup Sep 3, 2020
12d7afe
fix(Hook to send phone verification number.):
binh-dam-ibigroup Sep 3, 2020
74ab103
feat(NotificationPrefsPane): Add phone verification for existing users.
binh-dam-ibigroup Sep 4, 2020
33686c0
feat(NewAccountWizard): Add phone verification in account setup wizard.
binh-dam-ibigroup Sep 4, 2020
e36a76c
improvement(UserAccountScreen): Try throttling SMS code requests.
binh-dam-ibigroup Sep 4, 2020
106fa6d
refactor(NotificationPrefsPane): Add button to resend code. Rename me…
binh-dam-ibigroup Sep 8, 2020
f821a25
refactor: Rename symbols and tweak comments.
binh-dam-ibigroup Sep 8, 2020
586fa23
refactor(NotificationPrefsPane): Move styles into styled component.
binh-dam-ibigroup Sep 8, 2020
626fdb7
refactor: Address PR comments.
binh-dam-ibigroup Sep 15, 2020
714d795
docs(NotificationPrefsPane): Add comment+link regarding the fake phon…
binh-dam-ibigroup Sep 15, 2020
dff0778
fix(auth0-react): Make login/logout work with auth0-react.
binh-dam-ibigroup Sep 18, 2020
411b0bb
refactor: Adapt rest of code to auth0-react.
binh-dam-ibigroup Sep 18, 2020
390f485
build(deps): Remove use-auth0-hooks.
binh-dam-ibigroup Sep 18, 2020
2c962c4
fix(login): Support login from protected URLs.
binh-dam-ibigroup Sep 21, 2020
6fd4e62
docs(actions/auth.js): Tweak comments.
binh-dam-ibigroup Sep 21, 2020
92edadb
refactor(util/constants): Reinstate URL_ROOT.
binh-dam-ibigroup Sep 22, 2020
4a6c291
refactor(util/ui): Extract methods for redirecting to current route.
binh-dam-ibigroup Sep 23, 2020
0eedf9d
refactor(WithLoggedInUserSupport): Consolidate condition for fetching…
binh-dam-ibigroup Sep 23, 2020
3ac1fee
Merge branch 'dev' into auth0-react
binh-dam-ibigroup Sep 23, 2020
1fa9713
refactor(WithLoggedInUserSupport): Rename shouldFetchUser.
binh-dam-ibigroup Sep 24, 2020
5f0274a
Merge branch 'dev' into auth0-react
binh-dam-ibigroup Sep 24, 2020
45a2057
refactor(actions/user): Address PR comments.
binh-dam-ibigroup Oct 2, 2020
2dd7e10
refactor(actions/user): Extract common code from all methods.
binh-dam-ibigroup Oct 2, 2020
495bf04
refactor(actions/user): Refactor middleware methods.
binh-dam-ibigroup Oct 2, 2020
2154b28
refactor(actions/user): Tweak comments per PR feedback.
binh-dam-ibigroup Oct 5, 2020
e8f9d39
fix(actions/user): Do not persist user before sending sms req/after p…
binh-dam-ibigroup Oct 8, 2020
a328c77
refactor(NotificationPrefsPane): Tweak phone number revert functional…
binh-dam-ibigroup Oct 8, 2020
5d5c8a5
refactor(NotificationPrefsPane): Hide Revert Number if no phone numbe…
binh-dam-ibigroup Oct 8, 2020
c9bb706
refactor(withLoggedInUserSupport): Address PR comments
binh-dam-ibigroup Oct 9, 2020
8fe223e
refactor(WithLoggedInUserSupport): Stop passing auth0 to children.
binh-dam-ibigroup Oct 9, 2020
842ad9b
Merge branch 'dev' into auth0-react
binh-dam-ibigroup Oct 9, 2020
194b1b8
Merge branch 'dev' into phone-verification
binh-dam-ibigroup Oct 12, 2020
90009cc
refactor(UserAccountScreen): Adapt initial user persistence to Formik…
binh-dam-ibigroup Oct 13, 2020
bdbd857
refactor(config.yml): Make phone number regex configurable.
binh-dam-ibigroup Oct 13, 2020
084f6c7
refactor(NotificationsPrefsPane): Implement new phone verif. flow
binh-dam-ibigroup Oct 13, 2020
eadf635
refactor(NotificationPrefsPane): Various refactors
binh-dam-ibigroup Oct 13, 2020
7f5148d
refactor(NotificationPrefsPane): Update phone numbers following API c…
binh-dam-ibigroup Oct 14, 2020
f79a3f7
refactor(PhoneNumberEditor): Extract component from NotificationPrefs…
binh-dam-ibigroup Oct 15, 2020
79232ce
refactor: Make other light refactors.
binh-dam-ibigroup Oct 15, 2020
adc6897
refactor(UserAccountScreen): Move validation back to const. Add label…
binh-dam-ibigroup Oct 15, 2020
65d708c
Merge branch 'refactor-user-actions' into phone-verification
binh-dam-ibigroup Oct 15, 2020
920e0de
refactor(actions/user): Finish refactor user actions per #246 comments.
binh-dam-ibigroup Oct 15, 2020
7970429
refactor(user/actions): await fetches.
binh-dam-ibigroup Oct 15, 2020
9fa9b3c
refactor(PhoneNumberEditor): Add config for formatting numbers.
binh-dam-ibigroup Oct 15, 2020
5690ac8
refactor(NotificationPrefsPane): Use awesome-phone library.
binh-dam-ibigroup Oct 16, 2020
708f5b7
refactor(actions/user): Tweak error message text.
binh-dam-ibigroup Oct 16, 2020
b3837ec
Merge branch 'dev' into phone-verification
binh-dam-ibigroup Oct 16, 2020
6d2f94a
refactor(PhoneNumberEditor): Use react-phone-number-input
binh-dam-ibigroup Oct 19, 2020
2b7d992
refactor(NotificationPrefsPane): Use static text for email (same as v…
binh-dam-ibigroup Oct 19, 2020
31345ea
refactor(OtpReducer): Move default phone country to OTP reducer.
binh-dam-ibigroup Oct 20, 2020
f842563
test(otp-reducer): Update snapshot
binh-dam-ibigroup Oct 20, 2020
643ae43
refactor: Address PR comments
binh-dam-ibigroup Oct 20, 2020
2c4705c
refactor(PhoneNumberEditor): Exit edit mode if user enters same numbe…
binh-dam-ibigroup Oct 20, 2020
8e09348
refactor(UserAccountScreen): Handle SMS request error.
binh-dam-ibigroup Oct 20, 2020
d078e92
refactor(PhoneNumberEditor): Refactor, keep editing after SMS req err…
binh-dam-ibigroup Oct 21, 2020
4d5fcc8
refactor(PhoneNumberEditor): Refactor more
binh-dam-ibigroup Oct 21, 2020
a9dc87a
refactor(actions/user): Remove unencoutered id checks.
binh-dam-ibigroup Oct 21, 2020
e25ef5d
refactor(actions/user): Store auth0.user in redux state.
binh-dam-ibigroup Oct 21, 2020
3eee512
revert: Revert commits e25ef5d, 8fe223e
binh-dam-ibigroup Oct 21, 2020
67f8807
refactor(createUserReducer): Add initial user redux state.
binh-dam-ibigroup Oct 22, 2020
d359a8b
refactor(WithLoggedInUserSupport): Remove renderChidrenWithProps in b…
binh-dam-ibigroup Oct 22, 2020
99755e5
refactor(actions/user): Add method to ensure user's trips are loaded.
binh-dam-ibigroup Oct 22, 2020
dc1aabf
Merge branch 'dev' into auth0-react
binh-dam-ibigroup Oct 22, 2020
aab4530
fix(PhoneNumberEditor): Update pending number in Formik state.
binh-dam-ibigroup Oct 22, 2020
13d7936
fix(actions/user): Fix response with pagination.
binh-dam-ibigroup Oct 23, 2020
bc43d29
refactor(Remove excess user event handling.):
binh-dam-ibigroup Oct 23, 2020
3c48027
refactor(UserAccountScreen): Update Formik if new props are passed.
binh-dam-ibigroup Oct 26, 2020
b1d3d7c
refactor: Perofrm light refactor.
binh-dam-ibigroup Oct 26, 2020
cbf2d86
refactor(actions/user): Address throttle and expired code alerts.
binh-dam-ibigroup Oct 27, 2020
705919a
fix(user reducer): Add handling code for last SMS request.
binh-dam-ibigroup Oct 27, 2020
08e40f4
refactor(PhoneNumberEditor): Change code input type to 'text'.
binh-dam-ibigroup Oct 27, 2020
f40f4a3
refactor(PhoneNumberEditor): Add validation for enter key.
binh-dam-ibigroup Oct 27, 2020
166d00f
refactor(actions/user): Support async load of trips after loading use…
binh-dam-ibigroup Oct 27, 2020
a876b71
refactor(PhoneNumberEditor): Use input type='tel' for validation code.
binh-dam-ibigroup Oct 28, 2020
40871d2
fix(actions/user): Fix sms throttling.
binh-dam-ibigroup Oct 28, 2020
4ecd75c
refactor(PhoneNumberEditor): Mention code expiration in SMS instructi…
binh-dam-ibigroup Oct 28, 2020
738e9cf
refactor(PhoneNumberEditor): Tweak expiration text.
binh-dam-ibigroup Oct 28, 2020
9b74a57
refactor(Remove unused arg, tweak comment.):
binh-dam-ibigroup Oct 28, 2020
98118d7
Merge pull request #224 from opentripplanner/phone-verification
binh-dam-ibigroup Oct 28, 2020
d2e4caa
Merge branch 'dev' into auth0-react
binh-dam-ibigroup Oct 28, 2020
b27eb18
refactor: Resolve remaining merge issues from PR #224.
binh-dam-ibigroup Oct 28, 2020
98186fd
Merge pull request #233 from opentripplanner/auth0-react
binh-dam-ibigroup Oct 29, 2020
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
3 changes: 3 additions & 0 deletions __tests__/reducers/__snapshots__/create-otp-reducer.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Object {
"debouncePlanTimeMs": 0,
"homeTimezone": "America/Los_Angeles",
"language": Object {},
"phoneFormatOptions": Object {
"countryCode": "US",
},
"realtimeEffectsDisplayThreshold": 120,
"routingTypes": Array [],
"stopViewer": Object {
Expand Down
5 changes: 5 additions & 0 deletions example-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,8 @@ itinerary:
# modes:
# - WALK
# - BICYCLE

### If using OTP Middleware, you can define the optional phone number options below.
# phoneFormatOptions:
# # ISO 2-letter country code for phone number formats (defaults to 'US')
# countryCode: US
36 changes: 14 additions & 22 deletions lib/actions/auth.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { push } from 'connected-react-router'
import { replace, push } from 'connected-react-router'

import { setPathBeforeSignIn } from '../actions/user'

Expand Down Expand Up @@ -30,30 +30,22 @@ export function showLoginError (err) {
/**
* This function is called by the Auth0Provider component, with the described parameter(s),
* after the user signs in.
* @param {Object} appState The state that was stored when calling useAuth().login().
* @param {Object} appState The state stored when calling useAuth0().loginWithRedirect
* or when instantiating a component that uses withAuhenticationRequired.
*/
export function processSignIn (appState) {
return function (dispatch, getState) {
if (appState && appState.urlHash) {
// At this stage after login, Auth0 has already redirected to /signedin (Auth0-whitelisted)
// which shows the AfterLoginScreen.
//
// Here, we save the URL hash prior to login (contains a combination of itinerary search, stop/trip view, etc.),
// so that the AfterLoginScreen can redirect back there when logged-in user info is fetched.
// (For routing, it is easier to deal with the path without the hash sign.)
const hashIndex = appState.urlHash.indexOf('#')
const urlHashWithoutHash = hashIndex >= 0
? appState.urlHash.substr(hashIndex + 1)
: '/'
dispatch(setPathBeforeSignIn(urlHashWithoutHash))
} else if (appState && appState.returnTo) {
// TODO: Handle other after-login situations.
// Note that when redirecting from a login-protected (e.g. account) page while logged out,
// then returnTo is set by Auth0 to this object format:
// {
// pathname: "/"
// query: { ... }
// }
if (appState && appState.returnTo) {
// Remove URL parameters that were added by auth0-react
// (see https://github.com/auth0/auth0-react/blob/adac2e810d4f6d33253cb8b2016fcedb98a3bc16/examples/cra-react-router/src/index.tsx#L7).
window.history.replaceState({}, '', window.location.pathname)

// Here, we add the hash to the redux state (portion of the URL after '#' that contains the route/page name e.g. /account,
// and includes a combination of itinerary search, stop/trip view, etc.) that was passed to appState.returnTo prior to login.
// Once the redux state set, we redirect to the "/signedin" route (whitelisted in Auth0 dashboard), where the AfterLoginScreen
// will in turn fetch the user data then redirect the web browser back to appState.returnTo.
dispatch(setPathBeforeSignIn(appState.returnTo))
dispatch(replace('/signedin'))
}
}
}
Loading