CakeDC\Users\Controller\SocialAccountsController::validateAccount PHP Method

validateAccount() public method

Validates social account
public validateAccount ( string $provider, string $reference, string $token ) : Response
$provider string provider
$reference string reference
$token string token
return Cake\Network\Response
    public function validateAccount($provider, $reference, $token)
    {
        try {
            $result = $this->SocialAccounts->validateAccount($provider, $reference, $token);
            if ($result) {
                $this->Flash->success(__d('CakeDC/Users', 'Account validated successfully'));
            } else {
                $this->Flash->error(__d('CakeDC/Users', 'Account could not be validated'));
            }
        } catch (RecordNotFoundException $exception) {
            $this->Flash->error(__d('CakeDC/Users', 'Invalid token and/or social account'));
        } catch (AccountAlreadyActiveException $exception) {
            $this->Flash->error(__d('CakeDC/Users', 'Social Account already active'));
        } catch (Exception $exception) {
            $this->Flash->error(__d('CakeDC/Users', 'Social Account could not be validated'));
        }
        return $this->redirect(['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'login']);
    }