Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(applock): prevent unintentional logout when applock is active [15545] #18698

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

V-Gira
Copy link
Contributor

@V-Gira V-Gira commented Jan 31, 2025

Description

The app would log out on app initialization for team users if app lock is active, without giving them the chance to disable app lock

There is an observer that makes sure the app or the modal is not tempered with to prevent people to simply removing the app lock from the DOM

It appears the observer is too aggressive, and would logout a user automatically

Checklist

  • mentions the JIRA issue in the PR name (Ex. [WPB-XXXX])
  • PR has been self reviewed by the author;
  • Hard-to-understand areas of the code have been commented;
  • If it is a core feature, unit tests have been added;

@@ -156,11 +159,16 @@ const AppLock: React.FC<AppLockProps> = ({
app?.style.setProperty('pointer-events', isVisible ? 'none' : 'auto', 'important');

if (isVisible) {
modalObserver.observe(document.querySelector('#wire-main'), {
childList: true,
subtree: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was unable to pinpoint the exact cause, but this observer was checking for both childList and subtree for a removal attempt of the modal.
It doesn't seem to be necessary to include the subtree with our current code structure, as the app correctly logs out when removing the app lock modal from the DOM

@V-Gira V-Gira merged commit 0cf6a90 into dev Feb 3, 2025
21 of 22 checks passed
@V-Gira V-Gira deleted the v/applock-logout branch February 3, 2025 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants