XenForo - allow users to login directly (cookie timeout fix)

Discussion in 'Customization & add-ons' started by frybread, Mar 16, 2018.

  1. frybread

    frybread aMember Pro Customer

    Joined:
    Jul 14, 2008
    Messages:
    63
    Overview:
    This XenForo 1.5 plugin modification allows users to login to XenForo directly. Nothing else is changed, registration is still forwarded to amember, and users can still login via amember if they choose. This replicates the functionality of amember's old vBulletin 3 & 4 plugins, which worked much better in my opinion.

    The problem:
    Currently the XenForo 1.5 plugin forwards login AND registration to amember. Logging in to xenforo via amember causes issues with cookie timeouts, which you can witness on this very forum. (i.e. You're not able to stay logged in for very long or after you close your browser.)

    The solution:
    Allow users to login on XenForo.

    open this XenForo plugin file you received from amember,
    Code:
    \Amember\Redirect.php
    find:
    Code:
     if ($routeMatch->getControllerName() == 'XenForo_ControllerPublic_Logout') {
                self::redirect('/logout', $isAjax);
            }
    replace:
    Code:
     /* if ($routeMatch->getControllerName() == 'XenForo_ControllerPublic_Logout') {
                self::redirect('/logout', $isAjax);
            } */
    find:
    Code:
    if ($routeMatch->getControllerName() == 'XenForo_ControllerPublic_Login'
    replace:
    Code:
    if ($routeMatch->getControllerName() == 'XenForo_ControllerPublic_Register'
    Note: This is for XenForo 1, I have not tried XenForo 2 yet.
    Last edited: Mar 16, 2018
  2. frybread

    frybread aMember Pro Customer

    Joined:
    Jul 14, 2008
    Messages:
    63
    After some more testing, I had to disable single-sign-on (by removing the cookie prefix in amember on the xenforo plugin) as logging in to amember would break the cookies, regardless of where the user logged in after.

    After a little more digging, I now believe the cookie problem is an incorrect Global Salt in amember -> setup/configuration -> Xenforo. After grabbing the real salt from xenforo/library/XenForo/Application.php, cookies seem to be working really well! I've gone back to the original amember sign-in, making the first post in this thread rather useless. If you have this problem, check your global salt instead!

    I believe this forum has the same issue, as it's acting like my forum was.

    @caesar have you verified the Global Salt for this site's xenforo plugin?
    thachicc2000 likes this.
  3. thachicc2000

    thachicc2000 New Member

    Joined:
    Oct 11, 2012
    Messages:
    14
    @caesar
    Have you solved this problem yet? I also encountered the same problem (for XF2)

Share This Page