We need a way back to the tab when resetting passwords or getting a token from email or second factor authentication.
Too often we open a bunch of tabs and forget which one was open.
Imagine if we could create a token that would reopen the given tab that initiated the exit.
window.security.tabIdToken // returns: 35c7b72b-00bd-4734-81f7-318392f52370
Now when generating the reset password link in the form you pass through this token:
<form class="new_user" action="/users/password" accept-charset="UTF-8" method="post">
<input type="token" name="tab_id_token" value="35c7b72b-00bd-4734-81f7-318392f52370" />
<input autofocus="autofocus" autocomplete="email" placeholder="Your email" class="text-slate-600 m-3 placeholder-gray-400" type="email" name="user[email]" id="user_email">
<input type="submit" name="commit" value="Email me reset instructions" class="px-8 py-2 my-4 text-sm text-white bg-green-500 rounded-full hover:bg-green-600 cursor-pointer" data-disable-with="Email me reset instructions">
</form>
Then in the generated URL you would have the following:
https://web.site.com/reset_password?tab_id_token=35c7b72b-00bd-4734-81f7-318392f52370?password_reset_token=41256738912340136135128192
And the tab would push the URL of the reset password page to the password reset form because the tab ID tokens would match.
No more extra tabs opened and you get to pick up from where you left off.