Skip to content

Commit

Permalink
fixed errors
Browse files Browse the repository at this point in the history
  • Loading branch information
glena committed May 27, 2015
1 parent 2839a36 commit acb2ccd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion lib/WP_Auth0_UserCreator.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public function tokenHasRequiredScopes($jwt) {

return (
(isset($jwt->email) || isset($jwt->nickname))
&& isset(identities)
&& isset($jwt->identities)
);

}
Expand Down Expand Up @@ -57,6 +57,7 @@ public function create($userinfo, $token) {
} else {
throw new WP_Auth0_RegistrationNotEnabledException();
}

// If we are here we should have a valid $user_id with a new user or an existing one
// log him in, and update the auth0_user table
self::insertAuth0User($userinfo, $user_id);
Expand Down
9 changes: 5 additions & 4 deletions lib/WP_Auth0_UsersRepo.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
class WP_Auth0_UsersRepo {

public static function init() {
if (WP_Auth0_Options::get('jwt_auth_integration')) {
add_filter( 'wp_jwt_auth_get_user', array( __CLASS__, 'getUser' ), 1,2);
if (WP_Auth0_Options::get('jwt_auth_integration') == 1) {
add_filter( 'wp_jwt_auth_get_user', array( __CLASS__, 'getUser' ), 0,2);
}
}

public static function getUser($jwt, $encodedJWT) {

global $wpdb;

$sql = 'SELECT u.*
Expand All @@ -28,8 +29,8 @@ public static function getUser($jwt, $encodedJWT) {

$creator = new WP_Auth0_UserCreator();

if ($creator->tokenHasRequiredScopes($jwt->email)) {
$auth0User = $jwt
if ($creator->tokenHasRequiredScopes($jwt)) {
$auth0User = $jwt;
}
else {
$auth0User = json_decode($response['body']);
Expand Down

0 comments on commit acb2ccd

Please sign in to comment.