HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

jsConnect doesn't register new account when "registration" set to "connect"

For the website I'm working on, admins need to be able to create articles etc, when doing so a new thread needs to be created on our Vanilla Forums setup. On the articles page there'll be a link to the created forum thread, on which logged in and approved users (on the main site) can comment. I decided to use jsConnect since we don't want users to have to create a separate forum account. I've used the provided example to write a simple script to return the correct information when a user is logged in and approved;


  $frontBridge = new Frontbridge();

   

  $clientId = '';

  $clientSecret = '';

   

  $user = [];

   

  session_start();

  if ($frontBridge->isLoggedIn()) {

    $loggedInUser = $frontBridge->getLoggedInUser();

   

    if ($loggedInUser->isApproved()) {

      $user['uniqueid'] = $loggedInUser->getUniqueId();

      $user['name'] = $loggedInUser->getFullName();

      $user['email'] = $loggedInUser->getMailAddress();

      $user['photourl'] = $loggedInUser->getImage()->getUrl();

    }

  }

   

  $secure = true;

  writeJsConnect($user, $_GET, $clientId, $clientSecret, $secure);


In the admin dashboard I've checked both "This is trusted connection and can sync roles & permissions" and "Make this connection your default signin method", and the script works when I've set the "registrations" setting to "approval", it even creates a forum member when one doesn't exist yet. We don't want users to be able to register at all on the forum though, but when I set the "registration" setting to "connect" (which should only allow account creation through SSO), no account is created an I instead get the error "user with id [x] not found". Any idea how this issue can be solved?

Using Vanilla version 3.3

Tagged:

Comments

Sign In or Register to comment.