Skip to content

Commit

Permalink
Fixed account linking to user on first time login with a provider [pe…
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtremefaith committed Sep 7, 2016
1 parent 8c091b6 commit 9afdb93
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions wp-oauth.php
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ function wpoa_login_user($oauth_identity) {
// If user is not found by oauth identity, then attempt by email (if enabled).
if(get_option('wpoa_email_linking') && !$matched_user) {
$matched_user = $this->wpoa_match_wordpress_user_by_email($oauth_identity);
$_SESSION['WPOA']['LINK_ACCOUNT'] = TRUE;
}
// handle the matched user if there is one:
if ( $matched_user ) {
Expand All @@ -448,6 +449,8 @@ function wpoa_login_user($oauth_identity) {
wp_set_current_user( $user_id, $user_login );
wp_set_auth_cookie( $user_id );
do_action( 'wp_login', $user_login, $matched_user );
/* If this is a first time login for the provider, make sure to match it to the account */
if($_SESSION['WPOA']['LINK_ACCOUNT']) $this->wpoa_link_account($user_id);
// after login, redirect to the user's last location
$this->wpoa_end_login("Logged in successfully!");
}
Expand Down

0 comments on commit 9afdb93

Please sign in to comment.