Skip to content

Commit

Permalink
Merge pull request #111 from sassafrastech/master
Browse files Browse the repository at this point in the history
Added check for explicit redirect_to on login page
  • Loading branch information
miled committed Sep 17, 2015
2 parents 16a0c68 + dcad5ed commit 5c8cecc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion includes/widgets/wsl.auth.widgets.php
Expand Up @@ -171,6 +171,17 @@ function wsl_render_auth_widget( $args = array() )

$no_idp_used = true;

// Use the provided redirect_to if it is given and this is the login page.
if ( in_array( $GLOBALS["pagenow"], array( "wp-login.php", "wp-register.php" ) ) &&
!empty( $_REQUEST["redirect_to"] ) )
{
$redirect_to = $_REQUEST["redirect_to"];
}
else
{
$redirect_to = $current_page_url;
}

// display provider icons
foreach( $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG AS $item )
{
Expand All @@ -192,7 +203,7 @@ function wsl_render_auth_widget( $args = array() )
}

// build authentication url
$authenticate_url = $authenticate_base_url . "provider=" . $provider_id . "&redirect_to=" . urlencode( $current_page_url );
$authenticate_url = $authenticate_base_url . "provider=" . $provider_id . "&redirect_to=" . urlencode( $redirect_to );

// http://codex.wordpress.org/Function_Reference/esc_url
$authenticate_url = esc_url( $authenticate_url );
Expand Down

0 comments on commit 5c8cecc

Please sign in to comment.