Version Description
- Added the check for the username and if username is empty user email address will be used as username.
Download this release
Release Info
Developer | Access Keys |
Plugin | Social Login WordPress Plugin – AccessPress Social Login Lite |
Version | 3.2.3 |
Comparing to | |
See all releases |
Code changes from version 3.2.2 to 3.2.3
- accesspress-social-login-lite.php +2 -2
- inc/frontend/login_check.php +26 -26
- readme.txt +4 -1
accesspress-social-login-lite.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin name: Social Login WordPress Plugin - AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
-
version: 3.2.
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
@@ -12,7 +12,7 @@
|
|
12 |
*/
|
13 |
//Declearation of the necessary constants for plugin
|
14 |
if( !defined( 'APSL_VERSION' ) ) {
|
15 |
-
define( 'APSL_VERSION', '3.2.
|
16 |
}
|
17 |
|
18 |
if( !defined( 'APSL_IMAGE_DIR' ) ) {
|
3 |
Plugin name: Social Login WordPress Plugin - AccessPress Social Login Lite
|
4 |
Plugin URI: https://accesspressthemes.com/wordpress-plugins/accesspress-social-login-lite/
|
5 |
Description: A plugin to add various social logins to a site.
|
6 |
+
version: 3.2.3
|
7 |
Author: AccessPress Themes
|
8 |
Author URI: https://accesspressthemes.com/
|
9 |
Text Domain: accesspress-social-login-lite
|
12 |
*/
|
13 |
//Declearation of the necessary constants for plugin
|
14 |
if( !defined( 'APSL_VERSION' ) ) {
|
15 |
+
define( 'APSL_VERSION', '3.2.3' );
|
16 |
}
|
17 |
|
18 |
if( !defined( 'APSL_IMAGE_DIR' ) ) {
|
inc/frontend/login_check.php
CHANGED
@@ -183,7 +183,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
183 |
$user_email = $user_profile['id'].'@facebook.com';
|
184 |
}
|
185 |
$return_user_details->email = $user_email;
|
186 |
-
$return_user_details->username = strtolower( $user_profile['first_name'] );
|
187 |
$return_user_details->gender = $user_profile['gender'];
|
188 |
$return_user_details->url = $user_profile['link'];
|
189 |
$return_user_details->about = ''; //facebook doesn't return user about details.
|
@@ -335,7 +335,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
335 |
$response->last_name =( isset( $response->name[1] ) ) ? $response->name[1] : '';
|
336 |
$response->deuimage = $user_profile->profile_image_url_https;
|
337 |
$response->email = $user_profile->screen_name . '@twitter.com';
|
338 |
-
$response->username = strtolower($user_profile->screen_name);
|
339 |
$response->url = $user_profile->url;
|
340 |
$response->about = isset($user_profile->description) ? $user_profile->description : '';
|
341 |
$response->gender = isset($user_profile->gender) ? $user_profile->gender : 'N/A';
|
@@ -473,7 +473,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
473 |
if( !empty( $user->emails ) ) {
|
474 |
|
475 |
$response->email = $user->emails[0]->value;
|
476 |
-
$response->username = strtolower($user->name->givenName);
|
477 |
$response->first_name = $user->name->givenName;
|
478 |
$response->last_name = $user->name->familyName;
|
479 |
$response->deuid = $user->emails[0]->value;
|
@@ -485,24 +485,24 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
485 |
$response->deutype = 'google';
|
486 |
$response->status = 'SUCCESS';
|
487 |
$response->error_message = '';
|
488 |
-
}
|
489 |
else {
|
490 |
$response->status = 'ERROR';
|
491 |
$response->error_code = 2;
|
492 |
$response->error_message = "INVALID AUTHORIZATION";
|
493 |
}
|
494 |
-
}
|
495 |
else { // Signature Verification Failed
|
496 |
$response->status = 'ERROR';
|
497 |
$response->error_code = 2;
|
498 |
$response->error_message = "INVALID AUTHORIZATION";
|
499 |
}
|
500 |
-
}
|
501 |
elseif( $get['openid_mode'] == 'cancel' ) { // User Canceled your Request
|
502 |
$response->status = 'ERROR';
|
503 |
$response->error_code = 1;
|
504 |
$response->error_message = "USER CANCELED REQUEST";
|
505 |
-
}
|
506 |
else { // User failed to login
|
507 |
$response->status = 'ERROR';
|
508 |
$response->error_code = 3;
|
@@ -514,7 +514,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
514 |
function siteUrl() {
|
515 |
return site_url();
|
516 |
}
|
517 |
-
|
518 |
function callBackUrl() {
|
519 |
$connection = !empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
|
520 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
@@ -532,13 +532,13 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
532 |
$json_response = wp_remote_retrieve_body( $response );
|
533 |
return $json_response;
|
534 |
}
|
535 |
-
|
536 |
function redirect( $redirect ) {
|
537 |
if( headers_sent() ) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
538 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
539 |
echo $redirect;
|
540 |
echo '\';</script>';
|
541 |
-
}
|
542 |
else { // Default Header Redirect
|
543 |
header( 'Location: ' . $redirect );
|
544 |
}
|
@@ -554,7 +554,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
554 |
}
|
555 |
return $username;
|
556 |
}
|
557 |
-
|
558 |
function updateUser( $username, $email ) {
|
559 |
$row = $this->getUserByUsername( $username );
|
560 |
if( $row && $email != '' && $row->user_email != $email ) {
|
@@ -563,7 +563,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
563 |
wp_update_user( $row );
|
564 |
}
|
565 |
}
|
566 |
-
|
567 |
function getUserByMail( $email ) {
|
568 |
global $wpdb;
|
569 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_email = '$email'" );
|
@@ -572,7 +572,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
572 |
}
|
573 |
return false;
|
574 |
}
|
575 |
-
|
576 |
function getUserByUsername( $username ) {
|
577 |
global $wpdb;
|
578 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
|
@@ -581,7 +581,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
581 |
}
|
582 |
return false;
|
583 |
}
|
584 |
-
|
585 |
function creatUser( $user_name, $user_email ) {
|
586 |
$username = self:: get_username($user_name);
|
587 |
$random_password = wp_generate_password( 12, false );
|
@@ -597,7 +597,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
597 |
}
|
598 |
return $user_id;
|
599 |
}
|
600 |
-
|
601 |
function set_cookies( $user_id = 0, $remember = true ) {
|
602 |
if( !function_exists( 'wp_set_auth_cookie' ) ) {
|
603 |
return false;
|
@@ -610,17 +610,17 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
610 |
wp_set_current_user( $user_id );
|
611 |
return true;
|
612 |
}
|
613 |
-
|
614 |
function loginUser( $user_id ) {
|
615 |
$current_url_an = get_permalink();
|
616 |
$reauth = empty( $_REQUEST['reauth'] ) ? false : true;
|
617 |
if( $reauth )wp_clear_auth_cookie();
|
618 |
-
|
619 |
if( isset( $_REQUEST['redirect_to'] ) ) {
|
620 |
$redirect_to = $_REQUEST['redirect_to'];
|
621 |
// Redirect to https if user wants ssl
|
622 |
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
|
623 |
-
}
|
624 |
else {
|
625 |
$redirect_to = admin_url();
|
626 |
}
|
@@ -628,38 +628,38 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
628 |
// If cookies are disabled we can't log in even with a valid user+pass
|
629 |
if( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )$user = new WP_Error( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress." ) );
|
630 |
else $user = wp_signon( '', isset( $secure_cookie ) );
|
631 |
-
|
632 |
if( !$this->set_cookies( $user_id ) ) {
|
633 |
return false;
|
634 |
}
|
635 |
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : site_url();
|
636 |
$user_login_url = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
|
637 |
-
|
638 |
$options = get_option( APSL_SETTINGS );
|
639 |
if( isset( $options['apsl_custom_login_redirect_options'] ) && $options['apsl_custom_login_redirect_options'] != '' ) {
|
640 |
if( $options['apsl_custom_login_redirect_options'] == 'home' ) {
|
641 |
$user_login_url = home_url();
|
642 |
-
}
|
643 |
else if( $options['apsl_custom_login_redirect_options'] == 'current_page' ) {
|
644 |
if( isset( $_REQUEST['redirect_to'] ) ) {
|
645 |
$redirect_to = $_REQUEST['redirect_to'];
|
646 |
// Redirect to https if user wants ssl
|
647 |
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$user_login_url = preg_replace( '|^http://|', 'https://', $redirect_to );
|
648 |
-
}
|
649 |
else {
|
650 |
$user_login_url = home_url();
|
651 |
}
|
652 |
-
}
|
653 |
else if( $options['apsl_custom_login_redirect_options'] == 'custom_page' ) {
|
654 |
if( $options['apsl_custom_login_redirect_link'] != '' ) {
|
655 |
$login_page = $options['apsl_custom_login_redirect_link'];
|
656 |
$user_login_url = $login_page;
|
657 |
-
}
|
658 |
else {
|
659 |
$user_login_url = home_url();
|
660 |
}
|
661 |
}
|
662 |
-
}
|
663 |
else {
|
664 |
$user_login_url = home_url();
|
665 |
}
|
@@ -697,7 +697,7 @@ if( !class_exists( 'APSL_Lite_Login_Check_Class' ) ) {
|
|
697 |
global $wpdb;
|
698 |
$unique_verifier = sha1($result->deutype.$result->deuid);
|
699 |
$apsl_userdetails = "{$wpdb->prefix}apsl_users_social_profile_details";
|
700 |
-
|
701 |
$first_name = sanitize_text_field($result->first_name);
|
702 |
$last_name = sanitize_text_field($result->last_name);
|
703 |
$profile_url = sanitize_text_field($result->url);
|
183 |
$user_email = $user_profile['id'].'@facebook.com';
|
184 |
}
|
185 |
$return_user_details->email = $user_email;
|
186 |
+
$return_user_details->username = ($user_profile['first_name'] !='') ? strtolower( $user_profile['first_name'] ) : $user_email;
|
187 |
$return_user_details->gender = $user_profile['gender'];
|
188 |
$return_user_details->url = $user_profile['link'];
|
189 |
$return_user_details->about = ''; //facebook doesn't return user about details.
|
335 |
$response->last_name =( isset( $response->name[1] ) ) ? $response->name[1] : '';
|
336 |
$response->deuimage = $user_profile->profile_image_url_https;
|
337 |
$response->email = $user_profile->screen_name . '@twitter.com';
|
338 |
+
$response->username = ($user_profile->screen_name !='') ? strtolower($user_profile->screen_name) : $user_email;
|
339 |
$response->url = $user_profile->url;
|
340 |
$response->about = isset($user_profile->description) ? $user_profile->description : '';
|
341 |
$response->gender = isset($user_profile->gender) ? $user_profile->gender : 'N/A';
|
473 |
if( !empty( $user->emails ) ) {
|
474 |
|
475 |
$response->email = $user->emails[0]->value;
|
476 |
+
$response->username = ($user->name->givenName) ? strtolower($user->name->givenName) : $user_email;
|
477 |
$response->first_name = $user->name->givenName;
|
478 |
$response->last_name = $user->name->familyName;
|
479 |
$response->deuid = $user->emails[0]->value;
|
485 |
$response->deutype = 'google';
|
486 |
$response->status = 'SUCCESS';
|
487 |
$response->error_message = '';
|
488 |
+
}
|
489 |
else {
|
490 |
$response->status = 'ERROR';
|
491 |
$response->error_code = 2;
|
492 |
$response->error_message = "INVALID AUTHORIZATION";
|
493 |
}
|
494 |
+
}
|
495 |
else { // Signature Verification Failed
|
496 |
$response->status = 'ERROR';
|
497 |
$response->error_code = 2;
|
498 |
$response->error_message = "INVALID AUTHORIZATION";
|
499 |
}
|
500 |
+
}
|
501 |
elseif( $get['openid_mode'] == 'cancel' ) { // User Canceled your Request
|
502 |
$response->status = 'ERROR';
|
503 |
$response->error_code = 1;
|
504 |
$response->error_message = "USER CANCELED REQUEST";
|
505 |
+
}
|
506 |
else { // User failed to login
|
507 |
$response->status = 'ERROR';
|
508 |
$response->error_code = 3;
|
514 |
function siteUrl() {
|
515 |
return site_url();
|
516 |
}
|
517 |
+
|
518 |
function callBackUrl() {
|
519 |
$connection = !empty( $_SERVER['HTTPS'] ) ? 'https://' : 'http://';
|
520 |
$url = $connection . $_SERVER["HTTP_HOST"] . $_SERVER["PHP_SELF"];
|
532 |
$json_response = wp_remote_retrieve_body( $response );
|
533 |
return $json_response;
|
534 |
}
|
535 |
+
|
536 |
function redirect( $redirect ) {
|
537 |
if( headers_sent() ) { // Use JavaScript to redirect if content has been previously sent (not recommended, but safe)
|
538 |
echo '<script language="JavaScript" type="text/javascript">window.location=\'';
|
539 |
echo $redirect;
|
540 |
echo '\';</script>';
|
541 |
+
}
|
542 |
else { // Default Header Redirect
|
543 |
header( 'Location: ' . $redirect );
|
544 |
}
|
554 |
}
|
555 |
return $username;
|
556 |
}
|
557 |
+
|
558 |
function updateUser( $username, $email ) {
|
559 |
$row = $this->getUserByUsername( $username );
|
560 |
if( $row && $email != '' && $row->user_email != $email ) {
|
563 |
wp_update_user( $row );
|
564 |
}
|
565 |
}
|
566 |
+
|
567 |
function getUserByMail( $email ) {
|
568 |
global $wpdb;
|
569 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_email = '$email'" );
|
572 |
}
|
573 |
return false;
|
574 |
}
|
575 |
+
|
576 |
function getUserByUsername( $username ) {
|
577 |
global $wpdb;
|
578 |
$row = $wpdb->get_row( "SELECT * FROM $wpdb->users WHERE user_login = '$username'" );
|
581 |
}
|
582 |
return false;
|
583 |
}
|
584 |
+
|
585 |
function creatUser( $user_name, $user_email ) {
|
586 |
$username = self:: get_username($user_name);
|
587 |
$random_password = wp_generate_password( 12, false );
|
597 |
}
|
598 |
return $user_id;
|
599 |
}
|
600 |
+
|
601 |
function set_cookies( $user_id = 0, $remember = true ) {
|
602 |
if( !function_exists( 'wp_set_auth_cookie' ) ) {
|
603 |
return false;
|
610 |
wp_set_current_user( $user_id );
|
611 |
return true;
|
612 |
}
|
613 |
+
|
614 |
function loginUser( $user_id ) {
|
615 |
$current_url_an = get_permalink();
|
616 |
$reauth = empty( $_REQUEST['reauth'] ) ? false : true;
|
617 |
if( $reauth )wp_clear_auth_cookie();
|
618 |
+
|
619 |
if( isset( $_REQUEST['redirect_to'] ) ) {
|
620 |
$redirect_to = $_REQUEST['redirect_to'];
|
621 |
// Redirect to https if user wants ssl
|
622 |
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$redirect_to = preg_replace( '|^http://|', 'https://', $redirect_to );
|
623 |
+
}
|
624 |
else {
|
625 |
$redirect_to = admin_url();
|
626 |
}
|
628 |
// If cookies are disabled we can't log in even with a valid user+pass
|
629 |
if( isset( $_POST['testcookie'] ) && empty( $_COOKIE[TEST_COOKIE] ) )$user = new WP_Error( 'test_cookie', __( "<strong>ERROR</strong>: Cookies are blocked or not supported by your browser. You must <a href='http://www.google.com/cookies.html'>enable cookies</a> to use WordPress." ) );
|
630 |
else $user = wp_signon( '', isset( $secure_cookie ) );
|
631 |
+
|
632 |
if( !$this->set_cookies( $user_id ) ) {
|
633 |
return false;
|
634 |
}
|
635 |
$requested_redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : site_url();
|
636 |
$user_login_url = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
|
637 |
+
|
638 |
$options = get_option( APSL_SETTINGS );
|
639 |
if( isset( $options['apsl_custom_login_redirect_options'] ) && $options['apsl_custom_login_redirect_options'] != '' ) {
|
640 |
if( $options['apsl_custom_login_redirect_options'] == 'home' ) {
|
641 |
$user_login_url = home_url();
|
642 |
+
}
|
643 |
else if( $options['apsl_custom_login_redirect_options'] == 'current_page' ) {
|
644 |
if( isset( $_REQUEST['redirect_to'] ) ) {
|
645 |
$redirect_to = $_REQUEST['redirect_to'];
|
646 |
// Redirect to https if user wants ssl
|
647 |
if( isset( $secure_cookie ) && false !== strpos( $redirect_to, 'wp-admin' ) )$user_login_url = preg_replace( '|^http://|', 'https://', $redirect_to );
|
648 |
+
}
|
649 |
else {
|
650 |
$user_login_url = home_url();
|
651 |
}
|
652 |
+
}
|
653 |
else if( $options['apsl_custom_login_redirect_options'] == 'custom_page' ) {
|
654 |
if( $options['apsl_custom_login_redirect_link'] != '' ) {
|
655 |
$login_page = $options['apsl_custom_login_redirect_link'];
|
656 |
$user_login_url = $login_page;
|
657 |
+
}
|
658 |
else {
|
659 |
$user_login_url = home_url();
|
660 |
}
|
661 |
}
|
662 |
+
}
|
663 |
else {
|
664 |
$user_login_url = home_url();
|
665 |
}
|
697 |
global $wpdb;
|
698 |
$unique_verifier = sha1($result->deutype.$result->deuid);
|
699 |
$apsl_userdetails = "{$wpdb->prefix}apsl_users_social_profile_details";
|
700 |
+
|
701 |
$first_name = sanitize_text_field($result->first_name);
|
702 |
$last_name = sanitize_text_field($result->last_name);
|
703 |
$profile_url = sanitize_text_field($result->url);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: social, login, social login, facebook, twitter, google, social connect, s
|
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 3.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -137,6 +137,9 @@ Yes. You can use the AccessPress social login lite anywhere by using shortcode i
|
|
137 |
4. Backend Other settings Section.
|
138 |
|
139 |
== Changelog ==
|
|
|
|
|
|
|
140 |
= 3.2.2 =
|
141 |
* Done the code formatting and removal of unnecessary codes.
|
142 |
|
4 |
Donate link: http://accesspressthemes.com/donation/
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 3.2.3
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
137 |
4. Backend Other settings Section.
|
138 |
|
139 |
== Changelog ==
|
140 |
+
= 3.2.3 =
|
141 |
+
* Added the check for the username and if username is empty user email address will be used as username.
|
142 |
+
|
143 |
= 3.2.2 =
|
144 |
* Done the code formatting and removal of unnecessary codes.
|
145 |
|