/** * Authenticate a uniquely matched user. * * As long as there is exactly one match *and* that match * has a valid User Account, go ahead and process * authentication for them. * * @return MinistryPlatform\Blackpulp\User */ public function getUserAndAuthenticate() { if ($this->getNumberOfMatches() === 1) { $user_data = $this->matches->getTable(0); if (isset($user_data['User_GUID']) && $user_data['User_GUID'] > 0) { return $this->mp->authenticateGuid($user_data['User_GUID']); } else { throw new MinistryPlatformException("The matched contact has no User Account."); } } else { throw new MinistryPlatformException("A single user was not returned. " . "Review the getMatches() method to determine your next steps."); } }