Skip to content

Commit ce62381

Browse files
authored
fix: minor UX improvements (#811)
* fix: show access denied when no next factor is available * test: update tests to match new behaviour * chore: add css files to npmignore since they are already bundled * fix: make clearOnSubmit only clear on errors * fix: make SessionAuth not set the context before navigation * feat: make the name optional for custom provider configs * chore: update changelog * chore: remove outdated branch reference from test server deps * docs: fix examples relying on react-router-dom skipping navigation to the current page * fix: make validation failure redirection aware of the current url * test: add tests for sessionauth validation failure redirection * refactor: review comments * feat: make sessionauth throw if onFailureRedirectionURL returns a relative path * feat: validate the failure redirect url during success redirection
1 parent 0dd6150 commit ce62381

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+496
-173
lines changed

.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
**/*.ts
2+
**/*.css
23
**/*.tsx
34
!**/*.d.ts
45
.git/

CHANGELOG.md

+21
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [unreleased]
99

10+
## [0.40.0] - 2024-04-15
11+
12+
### Breaking Changes
13+
14+
- `onFailureRedirection` is no longer allowed to return relative paths.
15+
- We now throw an error if `onFailureRedirection` returns the current URL or path when:
16+
- redirecting away from the auth page (`websiteBasePath`, usually `/auth`) when a session already exists
17+
- redirecting after sign in/up
18+
- redirecting after successful email verification
19+
- redirecting after a successful MFA factor completion
20+
21+
### Changes
22+
23+
- We now redirect to the factor chooser screen if the MFA claim validator fails even if there is no available next factor. This will always show an access denied screen, which should help debugging.
24+
- `clearOnSubmit` now only clears the field value if the request returned an error. This is because the form navigates on success, making clearing the field unnecessary (which can lead to confusing UX if the navigation takes too long).
25+
- Fixed an issue where `SessionAuth` contents popped in before navigating away if a claim validator failed:
26+
- Now we ony set the context if `onFailureRedirection` returned the current URL.
27+
- Now we ony call the navigation function if `onFailureRedirection` returned something different than the current URL.
28+
- Made the `name` property optional in custom provider configs for usage with `usesDynamicLoginMethods`, where the tenant configuration is expected to set the name dynamically.
29+
- Note, that not setting the name will make the UI crash if the `usesDynamicLoginMethods` is set to `false` or if the tenant configuration doesn't include a provider list.
30+
1031
## [0.39.1] - 2024-03-27
1132

1233
- Fixes how we fetch the component to render based on the current path to take into account non auth recipes correctly.

examples/for-tests-react-16/src/App.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ export function getApiDomain() {
5757
export function getWebsiteDomain() {
5858
const websitePort = process.env.REACT_APP_WEBSITE_PORT || 3031;
5959
const websiteUrl = process.env.REACT_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
60-
return websiteUrl;
60+
61+
return getQueryParams("websiteDomain") ?? websiteUrl;
6162
}
6263

6364
/*

examples/for-tests/src/App.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function getApiDomain() {
5454
export function getWebsiteDomain() {
5555
const websitePort = process.env.REACT_APP_WEBSITE_PORT || 3031;
5656
const websiteUrl = process.env.REACT_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
57-
return websiteUrl;
57+
return getQueryParams("websiteDomain") ?? websiteUrl;
5858
}
5959

6060
/*

lib/build/components/assets/blockedIcon.d.ts

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/components/assets/otpEmailIcon.d.ts

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/components/assets/otpSMSIcon.d.ts

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/components/assets/totpIcon.d.ts

+2-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/emailpassword-shared9.js

+17-15
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/emailverification-shared2.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/genericComponentOverrideContext.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/index2.js

+61-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/multifactorauth-shared.js

+33
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/build/multifactorauth-shared2.js

+13-16
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)