Skip to content

Auto-login via referrer and server-side never triggers #237

Closed

Description

@gobrts

Two bugs in bcc-login 1.2.19:

  1. should_auto_login() runs on init and checks is_front_page(), which is always false before the main query runs. The server-side auto-login therefore never triggers. Moving the check to template_redirect should fix this.

  2. Typo in add_auto_login_script(): document.referer.indexOf(...) should be document.referrer.indexOf(...). It now throws a TypeError, so the referrer check never runs.

Result: visitors coming from portal.bcc.no / brunstad.org are never logged in automatically.

Activity

  1. cs1m0n commented on Nov 11, 2026

    @cs1m0n
    Member

    Both bugs are addressed in #238. Thanks for the clear report.

    1. document.referer typo: fixed. The script also ignores links within the site now. Without that, on a site whose own domain starts with bcc, a logged-out visitor who clicks Home from another page would be sent to log in.
    2. should_auto_login() on init: confirmed. is_front_page() is false there, so it has never fired since April 2023. Make auto-login from BCC referrers work again #238 removes it instead of moving it to template_redirect. Moved, it would have no once-per-session guard (anyone with the wp_has_logged_in cookie would be sent to login on every front-page visit). It would also match bcc anywhere in the referrer's host, and it would only run when the page cache misses. With the typo fixed, the front-page script covers the same cases, including on cached pages.

    Visitors coming from portal.bcc.no, brunstad.org or a host starting with bcc will be logged in automatically again once #238 is merged and a new bcc-login version is released.

    The silent sign-in on any page from #236 is tracked separately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions