Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
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
5 changes: 1 addition & 4 deletions src/components/provider/UALProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ export class UALProvider extends Component {
* @return {Void}
*/
showModal: () => {
const { availableAuthenticators } = this.state
availableAuthenticators.forEach(auth => auth.reset())
Copy link
Contributor

@nasser85 nasser85 Feb 25, 2020

Choose a reason for hiding this comment

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

What's the rationale for removing this line?

Copy link
Author

Choose a reason for hiding this comment

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

auth.reset() resets the authenticators to default and then calls the init method again, which adds to the initialization calls.

Copy link
Contributor

@nasser85 nasser85 Feb 25, 2020

Choose a reason for hiding this comment

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

Thanks. I see. A thing to keep in mind is the edge case where a developer would need their app to explicitly reset an active authenticator before calling showModal - otherwise the modal won't ever show up.

this.setState({ modal: true })
},
/**
Expand Down Expand Up @@ -233,8 +231,8 @@ export class UALProvider extends Component {
const accountName = window.localStorage.getItem('UALAccountName')
type = this.checkForInvalidatedSession(type, invalidate);
const ual = new UAL(chains, appName, authenticators)
const { availableAuthenticators, autoLoginAuthenticator } = ual.getAuthenticators()
try {
const { availableAuthenticators } = ual.getAuthenticators()
if (type) {
const authenticator = this.getAuthenticatorInstance(type, availableAuthenticators)
if (!authenticator) {
Expand All @@ -259,7 +257,6 @@ export class UALProvider extends Component {
const errType = UALErrorType.Login
console.warn(new UALError(msg, errType, e, source))
} finally {
const { availableAuthenticators, autoLoginAuthenticator } = ual.getAuthenticators()
this.fetchAuthenticators(availableAuthenticators, autoLoginAuthenticator)
}
}
Expand Down