diff options
author | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-18 15:31:13 -0400 |
---|---|---|
committer | Joseph Warner <hardolaf@hardolaf.com> | 2013-07-18 15:31:31 -0400 |
commit | 36f7913cc06aa299fa93ce83e4084993d31f1368 (patch) | |
tree | 886bc0407b05fc3331a0c0839b001b6b6e51d397 /phpBB/phpbb/auth/provider | |
parent | 2faaa7f63cd45244cd536b507325e65c5f085b39 (diff) | |
download | forums-36f7913cc06aa299fa93ce83e4084993d31f1368.tar forums-36f7913cc06aa299fa93ce83e4084993d31f1368.tar.gz forums-36f7913cc06aa299fa93ce83e4084993d31f1368.tar.bz2 forums-36f7913cc06aa299fa93ce83e4084993d31f1368.tar.xz forums-36f7913cc06aa299fa93ce83e4084993d31f1368.zip |
[feature/oauth] Finish authenticating user code
PHPBB3-11673
Diffstat (limited to 'phpBB/phpbb/auth/provider')
-rw-r--r-- | phpBB/phpbb/auth/provider/oauth/oauth.php | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/phpBB/phpbb/auth/provider/oauth/oauth.php b/phpBB/phpbb/auth/provider/oauth/oauth.php index afaae8a8ea..921ce830d9 100644 --- a/phpBB/phpbb/auth/provider/oauth/oauth.php +++ b/phpBB/phpbb/auth/provider/oauth/oauth.php @@ -150,6 +150,33 @@ class phpbb_auth_provider_oauth extends phpbb_auth_provider_base $result = $this->db->sql_query($sql); $row = $this->db->sql_fetchrow($result); $this->db->sql_freeresult($result); + + if (!$row) + { + // Account not tied to any existing account + // TODO: determine action that should occur + } + + // Retrieve the user's account + $sql = 'SELECT user_id, username, user_password, user_passchg, user_pass_convert, user_email, user_type, user_login_attempts + FROM ' . USERS_TABLE . " + WHERE user_id = '" . $this->db->sql_escape($row['user_id']) . "'"; + $result = $this->db->sql_query($sql); + $row = $this->db->sql_fetchrow($result); + $this->db->sql_freeresult($result); + + if (!$row) + { + // TODO: Update exception type and change it to language constant + throw new Exception('Invalid entry in ' . $this->auth_provider_oauth_token_account_assoc); + } + + // The user is now authenticated and can be logged in + return array( + 'status' => LOGIN_SUCCESS, + 'error_msg' => false, + 'user_row' => $row, + ); } else { $url = $service->getAuthorizationUri(); // TODO: modify $url for the appropriate return points |