Social Login - Version 6.2.4

Version Description

  • Fix in flow of Registration in plugin (OTP not received)
  • Fixed minor warnings
  • Fix for issue in redirect to same page
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Social Login
Version 6.2.4
Comparing to
See all releases

Code changes from version 6.2.3 to 6.2.4

class-mo-openid-login-widget.php CHANGED
@@ -597,8 +597,15 @@ if(mo_openid_is_customer_registered()) {
597
 
598
  private function mo_openid_load_login_script() {?>
599
  <script type="text/javascript">
600
- function moOpenIdLogin(app_name,is_custom_app) {
601
- <?php
 
 
 
 
 
 
 
602
 
603
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
604
  $http = "https://";
@@ -627,12 +634,6 @@ if(mo_openid_is_customer_registered()) {
627
  }
628
  }
629
  else {
630
- var current_url = window.location.href;
631
- var cname = "redirect_current_url";
632
- var d = new Date();
633
- d.setTime(d.getTime() + (2 * 24 * 60 * 60 * 1000));
634
- var expires = "expires="+d.toUTCString();
635
- document.cookie = cname + "=" + current_url + ";" + expires + ";path=/"; //path = root path(/)
636
 
637
  if ( request_uri.indexOf('wp-login.php') !=-1){
638
  var redirect_url = base_url + '/?option=oauthredirect&app_name=';
@@ -2393,11 +2394,12 @@ if(mo_openid_is_customer_registered()) {
2393
 
2394
  function mo_openid_get_redirect_url() {
2395
 
2396
- $current_url = $_COOKIE["redirect_current_url"];
2397
- $option = get_option( 'mo_openid_login_redirect' );
 
2398
  $redirect_url = site_url();
2399
 
2400
- if( $option == 'same' ) {
2401
  if(!is_null($current_url)){
2402
  $redirect_url = $current_url;
2403
  }
@@ -2412,11 +2414,11 @@ if(mo_openid_is_customer_registered()) {
2412
  $redirect_url = site_url().'/';
2413
  }
2414
  }
2415
- } else if( $option == 'homepage' ) {
2416
  $redirect_url = site_url();
2417
- } else if( $option == 'dashboard' ) {
2418
  $redirect_url = admin_url();
2419
- } else if( $option == 'custom' ) {
2420
  $redirect_url = get_option('mo_openid_login_redirect_url');
2421
  }
2422
 
@@ -2430,12 +2432,12 @@ if(mo_openid_is_customer_registered()) {
2430
 
2431
  function mo_openid_redirect_after_logout($logout_url) {
2432
  if(get_option('mo_openid_logout_redirection_enable')){
2433
- $option = get_option( 'mo_openid_logout_redirect' );
2434
  $redirect_url = site_url();
2435
- if( $option == 'homepage' ) {
2436
  $redirect_url = $logout_url . '&redirect_to=' .home_url() ;
2437
  }
2438
- else if($option == 'currentpage'){
2439
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
2440
  $http = "https://";
2441
  } else {
@@ -2443,10 +2445,10 @@ if(mo_openid_is_customer_registered()) {
2443
  }
2444
  $redirect_url = $logout_url . '&redirect_to=' . $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
2445
  }
2446
- else if($option == 'login') {
2447
  $redirect_url = $logout_url . '&redirect_to=' . site_url() . '/wp-admin' ;
2448
  }
2449
- else if($option == 'custom') {
2450
  $redirect_url = $logout_url . '&redirect_to=' . site_url() . (null !== get_option('mo_openid_logout_redirect_url')?get_option('mo_openid_logout_redirect_url'):'');
2451
  }
2452
  return $redirect_url;
597
 
598
  private function mo_openid_load_login_script() {?>
599
  <script type="text/javascript">
600
+ function moOpenIdLogin(app_name,is_custom_app) {
601
+ var current_url = window.location.href;
602
+ var cookie_name = "redirect_current_url";
603
+ var d = new Date();
604
+ d.setTime(d.getTime() + (2 * 24 * 60 * 60 * 1000));
605
+ var expires = "expires="+d.toUTCString();
606
+ document.cookie = cookie_name + "=" + current_url + ";" + expires + ";path=/";
607
+
608
+ <?php
609
 
610
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
611
  $http = "https://";
634
  }
635
  }
636
  else {
 
 
 
 
 
 
637
 
638
  if ( request_uri.indexOf('wp-login.php') !=-1){
639
  var redirect_url = base_url + '/?option=oauthredirect&app_name=';
2394
 
2395
  function mo_openid_get_redirect_url() {
2396
 
2397
+ $current_url = isset($_COOKIE["redirect_current_url"]) ? $_COOKIE["redirect_current_url"]:'';
2398
+ $current_url = str_replace('option=moopenid','',$current_url);
2399
+ $login_redirect_option = get_option( 'mo_openid_login_redirect' );
2400
  $redirect_url = site_url();
2401
 
2402
+ if( $login_redirect_option == 'same' ) {
2403
  if(!is_null($current_url)){
2404
  $redirect_url = $current_url;
2405
  }
2414
  $redirect_url = site_url().'/';
2415
  }
2416
  }
2417
+ } else if( $login_redirect_option == 'homepage' ) {
2418
  $redirect_url = site_url();
2419
+ } else if( $login_redirect_option == 'dashboard' ) {
2420
  $redirect_url = admin_url();
2421
+ } else if( $login_redirect_option == 'custom' ) {
2422
  $redirect_url = get_option('mo_openid_login_redirect_url');
2423
  }
2424
 
2432
 
2433
  function mo_openid_redirect_after_logout($logout_url) {
2434
  if(get_option('mo_openid_logout_redirection_enable')){
2435
+ $logout_redirect_option = get_option( 'mo_openid_logout_redirect' );
2436
  $redirect_url = site_url();
2437
+ if( $logout_redirect_option == 'homepage' ) {
2438
  $redirect_url = $logout_url . '&redirect_to=' .home_url() ;
2439
  }
2440
+ else if($logout_redirect_option == 'currentpage'){
2441
  if(isset($_SERVER['HTTPS']) && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off'){
2442
  $http = "https://";
2443
  } else {
2445
  }
2446
  $redirect_url = $logout_url . '&redirect_to=' . $http . $_SERVER["HTTP_HOST"] . $_SERVER['REQUEST_URI'];
2447
  }
2448
+ else if($logout_redirect_option == 'login') {
2449
  $redirect_url = $logout_url . '&redirect_to=' . site_url() . '/wp-admin' ;
2450
  }
2451
+ else if($logout_redirect_option == 'custom') {
2452
  $redirect_url = $logout_url . '&redirect_to=' . site_url() . (null !== get_option('mo_openid_logout_redirect_url')?get_option('mo_openid_logout_redirect_url'):'');
2453
  }
2454
  return $redirect_url;
class-mo-openid-sso-customer.php CHANGED
@@ -146,16 +146,16 @@ class CustomerOpenID {
146
 
147
  $username = get_option('mo_openid_admin_email');
148
  $phone = get_option('mo_openid_admin_phone');
149
- /* Current time in milliseconds since midnight, January 1, 1970 UTC. */
150
- $currentTimeInMillis = round(microtime(true) * 1000);
151
 
152
  /* Creating the Hash using SHA-512 algorithm */
153
- $stringToHash = $customerKey . number_format($currentTimeInMillis, 0, '', '') . $apiKey;
154
  $hashValue = hash("sha512", $stringToHash);
155
 
156
  $customerKeyHeader = "Customer-Key: " . $customerKey;
157
  $timestampHeader = "Timestamp: " . $currentTimeInMillis;
158
  $authorizationHeader = "Authorization: " . $hashValue;
 
159
  if($authType == 'EMAIL') {
160
  $fields = array(
161
  'customerKey' => $customerKey,
@@ -169,7 +169,7 @@ class CustomerOpenID {
169
  'phone' => $phone,
170
  'authType' => 'SMS',
171
  'transactionName' => 'WordPress miniOrange Social Login, Social Sharing'
172
- );
173
  }
174
  $field_string = json_encode($fields);
175
 
@@ -178,12 +178,18 @@ class CustomerOpenID {
178
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
179
  curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
180
  curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
181
-
182
- curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
183
- curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader,
184
- $timestampHeader, $authorizationHeader));
185
  curl_setopt( $ch, CURLOPT_POST, true);
186
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
 
 
 
 
 
 
 
187
  $content = curl_exec($ch);
188
 
189
  if(curl_errno($ch)){
@@ -194,6 +200,38 @@ class CustomerOpenID {
194
  return $content;
195
  }
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  function check_customer_valid(){
198
  $url = get_option('mo_openid_host_name') . '/moas/api/customer/license';
199
  $ch = curl_init($url);
146
 
147
  $username = get_option('mo_openid_admin_email');
148
  $phone = get_option('mo_openid_admin_phone');
149
+ $currentTimeInMillis = self::get_timestamp();
 
150
 
151
  /* Creating the Hash using SHA-512 algorithm */
152
+ $stringToHash = $customerKey . $currentTimeInMillis . $apiKey;
153
  $hashValue = hash("sha512", $stringToHash);
154
 
155
  $customerKeyHeader = "Customer-Key: " . $customerKey;
156
  $timestampHeader = "Timestamp: " . $currentTimeInMillis;
157
  $authorizationHeader = "Authorization: " . $hashValue;
158
+
159
  if($authType == 'EMAIL') {
160
  $fields = array(
161
  'customerKey' => $customerKey,
169
  'phone' => $phone,
170
  'authType' => 'SMS',
171
  'transactionName' => 'WordPress miniOrange Social Login, Social Sharing'
172
+ );
173
  }
174
  $field_string = json_encode($fields);
175
 
178
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
179
  curl_setopt( $ch, CURLOPT_AUTOREFERER, true );
180
  curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, false ); # required for https urls
181
+ curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false );
182
+ curl_setopt( $ch, CURLOPT_MAXREDIRS, 10 );
183
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", $customerKeyHeader, $timestampHeader, $authorizationHeader));
 
184
  curl_setopt( $ch, CURLOPT_POST, true);
185
  curl_setopt( $ch, CURLOPT_POSTFIELDS, $field_string);
186
+ $proxy_host = get_option("mo_proxy_host");
187
+ if(!empty($proxy_host)){
188
+ curl_setopt($ch, CURLOPT_PROXY, get_option("mo_proxy_host"));
189
+ curl_setopt($ch, CURLOPT_PROXYPORT, get_option("mo_proxy_port"));
190
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
191
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, get_option("mo_proxy_username").':'.get_option("mo_proxy_password"));
192
+ }
193
  $content = curl_exec($ch);
194
 
195
  if(curl_errno($ch)){
200
  return $content;
201
  }
202
 
203
+ function get_timestamp() {
204
+ $url = get_option ( 'mo_openid_host_name' ) . '/moas/rest/mobile/get-timestamp';
205
+ $ch = curl_init ( $url );
206
+
207
+ curl_setopt ( $ch, CURLOPT_FOLLOWLOCATION, true );
208
+ curl_setopt ( $ch, CURLOPT_ENCODING, "" );
209
+ curl_setopt ( $ch, CURLOPT_RETURNTRANSFER, true );
210
+ curl_setopt ( $ch, CURLOPT_AUTOREFERER, true );
211
+ curl_setopt ( $ch, CURLOPT_SSL_VERIFYPEER, false );
212
+ curl_setopt ( $ch, CURLOPT_SSL_VERIFYHOST, false ); // required for https urls
213
+
214
+ curl_setopt ( $ch, CURLOPT_MAXREDIRS, 10 );
215
+
216
+ curl_setopt ( $ch, CURLOPT_POST, true );
217
+
218
+ $proxy_host = get_option("mo_proxy_host");
219
+ if(!empty($proxy_host)){
220
+ curl_setopt($ch, CURLOPT_PROXY, get_option("mo_proxy_host"));
221
+ curl_setopt($ch, CURLOPT_PROXYPORT, get_option("mo_proxy_port"));
222
+ curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
223
+ curl_setopt($ch, CURLOPT_PROXYUSERPWD, get_option("mo_proxy_username").':'.get_option("mo_proxy_password"));
224
+ }
225
+ $content = curl_exec ( $ch );
226
+
227
+ if (curl_errno ( $ch )) {
228
+ echo 'Error in sending curl Request';
229
+ exit ();
230
+ }
231
+ curl_close ( $ch );
232
+ return $content;
233
+ }
234
+
235
  function check_customer_valid(){
236
  $url = get_option('mo_openid_host_name') . '/moas/api/customer/license';
237
  $ch = curl_init($url);
miniorange_openid_sso_settings.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
7
- * Version: 6.2.3
8
  * Author: miniOrange
9
  * Author URI: https://www.miniorange.com
10
  * License: GPL2
4
  * Plugin Name: Social Login, Social Sharing by miniOrange
5
  * Plugin URI: https://www.miniorange.com
6
  * Description: Allow your users to login, comment and share with Facebook, Google, Twitter, LinkedIn etc using customizable buttons.
7
+ * Version: 6.2.4
8
  * Author: miniOrange
9
  * Author URI: https://www.miniorange.com
10
  * License: GPL2
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.miniorange.com
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
  Tested up to: 4.9.4
7
- Stable tag: 6.2.3
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -166,6 +166,11 @@ Please email us at info@miniorange.com. You can also submit your query from the
166
 
167
 
168
  == Changelog ==
 
 
 
 
 
169
  = 6.2.3 =
170
  * Fixed warning during activation
171
 
@@ -464,6 +469,11 @@ Please email us at info@miniorange.com. You can also submit your query from the
464
  * First version of Social Login, Social Sharing plugin.
465
 
466
  == Upgrade Notice ==
 
 
 
 
 
467
  = 6.2.3 =
468
  * Fixed warning during activation
469
 
4
  Tags: social login, social, facebook, twitter, login
5
  Requires at least: 2.0.2
6
  Tested up to: 4.9.4
7
+ Stable tag: 6.2.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
166
 
167
 
168
  == Changelog ==
169
+ = 6.2.4 =
170
+ * Fix in flow of Registration in plugin (OTP not received)
171
+ * Fixed minor warnings
172
+ * Fix for issue in redirect to same page
173
+
174
  = 6.2.3 =
175
  * Fixed warning during activation
176
 
469
  * First version of Social Login, Social Sharing plugin.
470
 
471
  == Upgrade Notice ==
472
+ = 6.2.4 =
473
+ * Fix in flow of Registration in plugin (OTP not received)
474
+ * Fixed minor warnings
475
+ * Fix for issue in redirect to same page
476
+
477
  = 6.2.3 =
478
  * Fixed warning during activation
479