Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

MM-13741 Load user after setting up MFA on login or sign up #2464

Merged
merged 4 commits into from
Mar 12, 2019
Merged

Conversation

jwilander
Copy link
Member

Summary

This will fix a user not being redirected to the correct place after logging and being required to set up MFA (due it being enforced) and it will make sure that the user loads all the data the client assumes has been loaded after login.

Ticket Link

https://mattermost.atlassian.net/browse/MM-13741

Checklist

  • Ran make check-style to check for style errors (required for all pull requests)
  • Ran make test to ensure unit and component tests passed
  • Added or updated unit tests (required for all new features)

@jwilander jwilander added the 2: Dev Review Requires review by a core commiter label Mar 7, 2019
return {

// Assume we need to load the user if they don't have any team memberships loaded
shouldLoadUser: isEmptyObject(getTeamMemberships(state)),
Copy link
Member Author

Choose a reason for hiding this comment

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

In the case that the user is truly not on any teams and has already loaded all their data (not sure how they'd get into that state) then this might cause an extra few HTTP requests to load the user's data again. In 99.9% of the cases though if their team memberships are empty, they likely need to load all their data.

Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate that the Confirm component has to "know" about this. And I presume this fix might actually help in other invocations to redirectUserToDefaultTeam? What if we moved the empty test into that action instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

That's actually a really good idea. Let me try that 👍

return {

// Assume we need to load the user if they don't have any team memberships loaded
shouldLoadUser: isEmptyObject(getTeamMemberships(state)),
Copy link
Member

Choose a reason for hiding this comment

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

It's unfortunate that the Confirm component has to "know" about this. And I presume this fix might actually help in other invocations to redirectUserToDefaultTeam? What if we moved the empty test into that action instead?

@jwilander
Copy link
Member Author

Ready for re-review

Copy link
Member

@lieut-data lieut-data left a comment

Choose a reason for hiding this comment

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

🎉

@jwilander jwilander merged commit 4fdd95e into master Mar 12, 2019
@jwilander jwilander deleted the mm-13741 branch March 12, 2019 12:52
@lindalumitchell lindalumitchell added this to the v5.10.0 milestone Mar 15, 2019
@amyblais amyblais added Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation labels Mar 19, 2019
@lindy65 lindy65 added Tests/Not Needed Does not require new release tests and removed 2: Dev Review Requires review by a core commiter labels Mar 26, 2019
stevepartridge pushed a commit to stevepartridge/mattermost-webapp that referenced this pull request Mar 30, 2019
…st#2464)

* Load user after setting up MFA on login or sign up

* Move load user logic into redirectUserToDefaultTeam

* Clean up unit test
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Changelog/Done Required changelog entry has been written Docs/Not Needed Does not require documentation Tests/Not Needed Does not require new release tests
Projects
None yet
6 participants