The discussion revolves around a bug where the login modal does not appear when accessing the /login page directly in a private Discourse forum, unlike the /signup page which works correctly. Users gingerman, jomaxro, and artursmirnov highlight the inconsistency, with jomaxro confirming it as a bug. techAPJ explains the behavior was intentional but acknowledges the need for consistency. The issue is tied to browser popup blocking when the login action isn’t triggered by a user click, especially with OAuth providers like GitHub. sam and techAPJ propose a solution: defaulting to full-screen login when no user interaction occurs, which was implemented via commit 427979e.
It has traditionally been that way as far as my memory goes!
For the sites requiring login i.e. private forums, anons are redirected to /login and from there, they have to click the log in button (generally displayed twice) to key in their login details and then they can continue from there.
I’m not sure if that’s a longstanding bug or something but it has been this way for the last 1 year at least.
This doesn’t sound intentional to me. The behavior of /login should be consistent regardless of how login_required is set. It should always show the login modal.
Yeah, I tested this. Here’s a random login required site: https://forums.anki.com/login. Loading that in incognito does not make the login modal appear. However, loading https://meta.discourse.org/login in incognito does make the login modal appear.
I can’t think of a reason for the inconsistency, so yes, I’d say confirmed bug. But there could be history that I’m not aware of that would account for the difference…
We have similar issue at Travis CI community forum. We have only GitHub authorization enabled, because all our users obviously have Gtihub account. So it just opens a popup whenever user clicks on “Login” button. But when the login page is accessed directly by the link (e.g. https://travis-ci.community/login), the popup is blocked by browser as it isn’t triggered by user action. And login looks broken because of that.
The same happens when unauthorized user is directed to the new post page (http://travis-ci.community/new-topic?title=topic%20title). The forum tries to authorize the user, but popup gets blocked by browser and nothing actually happens.
This is an interesting and legit edge case, we should force full screen login for cases like this.
@techAPJ can you take this, we already have all the code for “full screen login” so if we do stuff like /new-topic it should force you through that flow and not pop windows up.
I think that happens because the login needs to be on github, so it tries to open the oauth window to login with github, but the popup should be opened with a user action.
When it tries to open the popup when the user just accessed the link, I think the browser blocks the popup because the user haven’t clicked in anything yet (it needs a user interaction, otherwise blocks the popup).
If you try to access the login link (https://travis-ci.community/login) the popup is blocked, but if you click the login button at the top of the page, it isn’t blocked.
For the most common login flow, where the user can login with just the email (even if there social login options), like here in meta, the popup to another domain for the oauth is not triggered when the user access /login, but only after the user clicks in the social login option. The first “popup” that shows is just a modal in the same page.
A possible solution is to show in a modal, or in a page (if don’t want to be in a modal), that has a button (like Login with Github), and only after the user clicks this button the oauth window show (not the best solution, because there is one more step, but I don’t know if this is possible without another step).
Yeah we got to review our auth code and make sure we always check that a “click” happened prior to doing any pop up logging in.
I think just defaulting to “full screen log in” if there was no click should be fine as a general solution. (eg we could simply default to full screen, and then on the “github/google” etc. buttons opt for non full screen)