I was working on this bug and I'm not sure if my fix is best for that issue. From the beginning... Steps to reproduce:
window (or select message on the list and then open it in new tab/window) 3. Click logout in the second tab. 4. Click on other message in the first tab.
Now login form is displayed in preview pane. Of course you cannot simply log in inside preview pane frame. My patch adds that possibility, but I've observed strange thing (without the patch). After step 3 it is possible to select mailbox in first tab without re-login, so why re-login is needed in preview pane. Is there a better workaround for this issue?
My patch also adds fine side effect. Possibility to use links like href="https://my.webmail.com/?_task=mail&_action=compose&_to=some@mail.com..." outside of roundcube.