Skip to content

Commit

Permalink
fix: minor UX improvements (#811)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
porcellus authored Apr 15, 2024
1 parent 0dd6150 commit ce62381
Show file tree
Hide file tree
Showing 57 changed files with 496 additions and 173 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
**/*.ts
**/*.css
**/*.tsx
!**/*.d.ts
.git/
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [unreleased]

## [0.40.0] - 2024-04-15

### Breaking Changes

- `onFailureRedirection` is no longer allowed to return relative paths.
- We now throw an error if `onFailureRedirection` returns the current URL or path when:
- redirecting away from the auth page (`websiteBasePath`, usually `/auth`) when a session already exists
- redirecting after sign in/up
- redirecting after successful email verification
- redirecting after a successful MFA factor completion

### Changes

- 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.
- `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).
- Fixed an issue where `SessionAuth` contents popped in before navigating away if a claim validator failed:
- Now we ony set the context if `onFailureRedirection` returned the current URL.
- Now we ony call the navigation function if `onFailureRedirection` returned something different than the current URL.
- Made the `name` property optional in custom provider configs for usage with `usesDynamicLoginMethods`, where the tenant configuration is expected to set the name dynamically.
- 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.

## [0.39.1] - 2024-03-27

- Fixes how we fetch the component to render based on the current path to take into account non auth recipes correctly.
Expand Down
3 changes: 2 additions & 1 deletion examples/for-tests-react-16/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export function getApiDomain() {
export function getWebsiteDomain() {
const websitePort = process.env.REACT_APP_WEBSITE_PORT || 3031;
const websiteUrl = process.env.REACT_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;

return getQueryParams("websiteDomain") ?? websiteUrl;
}

/*
Expand Down
2 changes: 1 addition & 1 deletion examples/for-tests/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function getApiDomain() {
export function getWebsiteDomain() {
const websitePort = process.env.REACT_APP_WEBSITE_PORT || 3031;
const websiteUrl = process.env.REACT_APP_WEBSITE_URL || `http://localhost:${websitePort}`;
return websiteUrl;
return getQueryParams("websiteDomain") ?? websiteUrl;
}

/*
Expand Down
3 changes: 2 additions & 1 deletion lib/build/components/assets/blockedIcon.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/build/components/assets/otpEmailIcon.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/build/components/assets/otpSMSIcon.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/build/components/assets/totpIcon.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions lib/build/emailpassword-shared9.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/build/emailverification-shared2.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lib/build/genericComponentOverrideContext.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

85 changes: 61 additions & 24 deletions lib/build/index2.js

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions lib/build/multifactorauth-shared.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 13 additions & 16 deletions lib/build/multifactorauth-shared2.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ce62381

Please sign in to comment.