Guest User

Untitled

a guest
Jan 23rd, 2018
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. <?php
  2.  
  3. // if you were logging in locally
  4. $userAccount = $accountService->findOneBy(array(
  5. 'username' => $userName,
  6. 'password' => $passwordHash
  7. ));
  8.  
  9. $accountAdapter = new Account\Adapter\Local($userAccount);
  10.  
  11.  
  12.  
  13. ///////////////////////////
  14.  
  15.  
  16.  
  17. // or if you were logging in with google
  18. $userAccount = $googleService->getInformationReturnedFromGoogleAfterAuthenticating();
  19. $accountAdapter = new Account\Adapter\Google($userAccount);
  20.  
  21.  
  22.  
  23. // either way you do the following…
  24.  
  25.  
  26. $account = new Account($accountAdapter);
  27. $credential = $authenticationService->createProfileFromAccount($account);
  28.  
  29. $user = $authenticationService->findUserWithCredential($credential);
Add Comment
Please, Sign In to add comment