-
Notifications
You must be signed in to change notification settings - Fork 687
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
Handle multiple instances of source /generate #5048
Handle multiple instances of source /generate #5048
Conversation
When the source opens more than one browser tabs on /generate before clicking on SUBMIT DOCUMENTS: -Flashes a message promting the source to verify their codename in /lookup after they click on SUBMIT DOCUMENTS in a fist instance of /generate. -Redirects the source to /lookup when they click on SUBMIT DOCUMENTS in a second instance of /generate and displays a flash message prompting the source to verify their codename. -Makes the codename in /lookup visible by default. This eliminates the 500 server error reported in freedomofpress#4458 and reduces the potential of codename confusion following the generation of multiple codenames in different browser tabs or windows. The behavior when only one instance of /generate is opened remains unchanged.
This PR follows the discussions in #4996. It is a work in progress with placeholder messages for which I would like to get feedback from the team before going forward in updating the tests and implementing new ones. Here is a demonstration of the proposed behavior:
If, alternatively, the source clicked "SUBMIT DOCUMENTS" in tab B first and then in tab A, the result would be similar except the flashed messages would be interverted. There is no change in the interface behavior when only one Also, an alternative to making the codename visible would be to add a link in the flash message similar to when the source makes their first submission: |
Update the two existing tests to reflect the source interface behavior modification introduced by c67db8e. In both cases, the source should be redirected to the /lookup page with a relevant flash message.
From a UX perspective, this LGTM. Tested as follows: 2x get started
get started, login in separate tabs
JI check
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM based on manual testing. Will hold off on merge pending a more exhaustive code review (due to implications of session changes).
Thanks for the comments @zenmonkeykstop. I marked the PR as WIP to make sure it was going in the right direction following the comments in #4996. I still want to add functional tests before it is merged and would also appreciate feedback on the wording of the flash messages as I am not native English speaker and there may be better ways to phrase these. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the approach here looks good, if you add functional tests prior to merge that would be excellent
# Issue 2386: don't log in on duplicates | ||
del session['codename'] | ||
|
||
# Issue 4361: Delete 'logged_in' if it's in the session |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
confirming that #4391 was a fix required when we were deleting session['codename']
in this view function and so is good to remove now
The flash messages look good to me with the exception of one period :). With functional test updates, this should be good to go. |
I think we're definitely closer to a resolution here, thanks for all your hard work on this @DrGFreeman. If some version of this lands, I'd like to give @ninavizz a chance to help with the final UI messaging at minimum. She suggested in the other PR that we might want to display the codename inline in the message; that could potentially be handled as a separate issue. I do think we should talk a bit more whether this is the best approach, though. I'm getting a "multiple codenames" message on the subsequent page if I just reload the |
Hi, thanks to all for the comments.
@eloquence, I agree with you, this is not desirable. I should have thought of checking this in the first place. I've been thinking about how to solve this issue elegantly for a while now and I think the fundamental issue preventing this is that we currently cannot uniquely identify each browser tab in which a codename is generated. As per my previous comment, if we could do so, it would be possible to ensure the codename displayed in the tab from which the user clicks "SUBMIT DOCUMENTS" is the one used for the login and thus avoid having to use the flash message altogether. The only message required would be the "already logged in, please check your codename" message when the user clicks "SUBMIT DOCUMENTS" in the second tab. If someone experienced could comment on the feasibility of my proposal and potentially give some high level direction of how to make it work, I'd be glad to take the time and try to implement it.
Absolutely! That's why I set this PR to WIP. I see three options with respect to displaying the codename to the user:
I think that 1 and 2 have the advantage of allowing the source to hide back the codename while proceeding with their submission which cannot be done if it is included in the flash message. |
Another option might be to move the regular "remember, your codename is.. " box up to the top, so that it's always front and center for new logins. Then if folks are getting the multiple tabs flash, the thing they need to check is just below it. |
Closing in favor of #5075 which resolves the refresh issue identified by @eloquence above and in my opinion offers a much smoother user experience (source registered with the codename displayed in the tab from which they proceed to submit documents and only one flash message when the source is already logged-in). |
Status
Work in progress
Description of Changes
Fixes #4458.
Changes proposed in this pull request:
When the source opens more than one browser tabs on /generate before clicking on SUBMIT DOCUMENTS:
This eliminates the 500 server error reported in #4458 and reduces the potential of codename confusion following the generation of multiple codenames in different browser tabs or windows.
The behavior when only one instance of /generate is opened remains unchanged.
Testing
How should the reviewer test this PR?
Write out any special testing steps here.
Deployment
Any special considerations for deployment? Consider both:
Checklist
If you made changes to the server application code:
make lint
) and tests (make test
) pass in the development containerIf you made changes to
securedrop-admin
:make -C admin test
) pass in the admin development containerIf you made changes to the system configuration:
If you made non-trivial code changes:
If you made changes to documentation:
make docs-lint
) passed locallyIf you added or updated a code dependency:
Choose one of the following: