Google Apps Login - Version 3.4.6

Version Description

Fixed: Auth errors when redirect login is enabled Removed: gal_login_form_readyjs filter.

Download this release

Release Info

Developer chrisakelley
Plugin Icon 128x128 Google Apps Login
Version 3.4.6
Comparing to
See all releases

Code changes from version 3.4.5 to 3.4.6

core/core_google_apps_login.php CHANGED
@@ -321,7 +321,6 @@ class Core_Google_Apps_Login {
321
  public function ga_start_auth_get_url() {
322
  $options = $this->get_option_galogin();
323
  $clients = $this->create_google_client( $options );
324
- /** @var GoogleGAL_Client $client */
325
  $client = $clients[0];
326
 
327
  // Generate a CSRF token
@@ -363,13 +362,13 @@ class Core_Google_Apps_Login {
363
 
364
  if ( $do_autologin && '' !== $options['ga_clientid'] && '' !== $options['ga_clientsecret'] ) {
365
  if ( ! headers_sent() ) {
366
- wp_safe_redirect( $auth_url );
367
  exit;
368
  } else {
369
  ?>
370
- <p><b><?php printf( __( 'Redirecting to <a href="%s">Login via Google</a>...', 'google-apps-login' ), esc_url( $auth_url ) ); // @codingStadardsIgnoreLine ?></b></p>
371
  <script type="text/javascript">
372
- window.location = "<?php echo esc_url( $auth_url ); ?>";
373
  </script>
374
  <?php
375
  }
@@ -379,7 +378,7 @@ class Core_Google_Apps_Login {
379
  <?php
380
  if ( isset( $options['btn_google_signin_image'] ) && ! empty( $options['btn_google_signin_image'] ) && 'custom_text' !== $options['btn_google_signin_image'] ) {
381
  $login_with_google_image = $options['btn_google_signin_image'];
382
- $login_with_google_button = '<a href="' . esc_url( $auth_url ) . '">
383
  <span class="google-apps-header ' . $login_with_google_image . '">
384
  <span class="inner">
385
  <span class="icon ' . $login_with_google_image . '"></span>
@@ -399,7 +398,7 @@ class Core_Google_Apps_Login {
399
  }
400
  ?>
401
  <p class="galogin" style="cursor: pointer;background: none;box-shadow: none;">
402
- <?php echo $login_with_google_button; // @codingStandardsIgnoreLine ?>
403
  </p>
404
 
405
 
@@ -409,8 +408,6 @@ class Core_Google_Apps_Login {
409
 
410
  <script>
411
  jQuery(document).ready(function(){
412
- <?php ob_start(); /* Buffer javascript contents so we can run it through a filter */ ?>
413
-
414
  var loginform = jQuery('#loginform,#front-login-form');
415
  var googlelink = jQuery('p.galogin');
416
  var poweredby = jQuery('p.galogin-powered');
@@ -428,10 +425,6 @@ class Core_Google_Apps_Login {
428
  }
429
  loginform.prepend(googlelink);
430
 
431
- <?php
432
- $fntxt = ob_get_clean();
433
- echo apply_filters( 'gal_login_form_readyjs', $fntxt ); // @codingStandardsIgnoreLine
434
- ?>
435
  });
436
  </script>
437
  <?php
@@ -450,12 +443,12 @@ class Core_Google_Apps_Login {
450
  $options = $this->get_option_galogin();
451
 
452
  if ( array_key_exists( 'redirect_to', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['redirect_to'] ) ) ) {
453
- return sanitize_text_field( wp_unslash( $_REQUEST['redirect_to'] ) );
454
  } elseif ( is_multisite() && ! $options['ga_ms_usesubsitecallback'] ) {
455
  return admin_url(); // This is what WordPress would choose as default
456
  // but we have to specify explicitly since all callbacks go via root site
457
  }
458
- return admin_url();
459
  }
460
 
461
  public function ga_authenticate( $user, $username = null, $password = null ) {
@@ -499,8 +492,8 @@ class Core_Google_Apps_Login {
499
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Session mismatch - try again, but there could be a problem passing state', 'google-apps-login' ) );
500
  return $this->display_and_return_error( $user );
501
  }
502
- $retnonce = $statevars[0];
503
- $retredirectto = $statevars[1];
504
 
505
  if ( ! $this->session_indep_verify_nonce( $retnonce, 'google_apps_login-' . $this->get_cookie_value() ) ) {
506
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Session mismatch - try again, but there could be a problem setting cookies', 'google-apps-login' ) );
@@ -509,7 +502,6 @@ class Core_Google_Apps_Login {
509
 
510
  try {
511
  $clients = $this->create_google_client( $options, true );
512
- /** @var GoogleGAL_Client $client */
513
  $client = $clients[0];
514
  $oauthservice = $clients[1];
515
 
@@ -521,7 +513,7 @@ class Core_Google_Apps_Login {
521
  && property_exists( $userinfo, 'verifiedEmail' ) ) {
522
 
523
  $google_email = $userinfo->email;
524
- $google_verified_email = $userinfo->verifiedEmail; // @codingStandardsIgnoreLine
525
 
526
  if ( ! $google_verified_email ) {
527
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Email needs to be verified on your Google Account', 'google-apps-login' ) );
@@ -582,9 +574,8 @@ class Core_Google_Apps_Login {
582
 
583
  protected function display_and_return_error( $user ) {
584
  if ( is_wp_error( $user ) && get_bloginfo( 'version' ) < 3.7 ) {
585
- // Only newer WordPress versions display errors from $user for us
586
  global $error;
587
- /** @var WP_Error $user */
588
  $error = htmlentities2( $user->get_error_message() );
589
  }
590
  return $user;
@@ -907,15 +898,14 @@ class Core_Google_Apps_Login {
907
 
908
  if ( isset( $_REQUEST['error_setting'] ) && is_array( $_REQUEST['error_setting'] )
909
  && isset( $_REQUEST['error_code'] ) && is_array( $_REQUEST['error_code'] ) ) {
910
- $error_code = wp_unslash( $_REQUEST['error_code'] ); // @codingStandardIgnoreLine
911
- $error_setting = wp_unslash( $_REQUEST['error_setting'] ); // @codingStandardIgnoreLine
912
- if ( count( $error_code ) > 0 && count( $error_code ) === count( $error_setting ) ) {
913
- $count = count( $error_code );
914
  for ( $i = 0; $i < $count; ++$i ) {
915
  ?>
916
  <div id="setting-error-settings_<?php echo esc_attr( $i ); ?>" class="error settings-error">
917
  <p>
918
- <strong><?php echo esc_html( htmlentities2( $this->get_error_string( $error_setting[ $i ] . '|' . $error_code[ $i ] ) ) ); ?></strong>
919
  </p>
920
  </div>
921
  <?php
@@ -1082,11 +1072,7 @@ class Core_Google_Apps_Login {
1082
  protected function ga_advancedsection_text() {
1083
  echo '<div id="advanced-section" class="galtab">';
1084
  echo '<p>';
1085
- printf(
1086
- __( 'Once you have the plugin working, you can try these settings to customize the login flow for your users.', 'google-apps-login' )
1087
- . ' ' . esc_html__( 'See <a href="%s" target="gainstr">instructions here</a>.', 'google-apps-login' ),
1088
- esc_url( $this->calculate_instructions_url( 'a' ) ) . '#advanced'
1089
- );
1090
  echo '</p>';
1091
 
1092
  $options = $this->get_option_galogin();
@@ -1201,10 +1187,7 @@ class Core_Google_Apps_Login {
1201
 
1202
  if ( is_multisite() ) {
1203
  echo '<h3>' . esc_html__( 'Multisite Options', 'google-apps-login' ) . '</h3><p>';
1204
- printf(
1205
- __( 'This setting is for multisite admins only. See <a href="%s" target="gainstr">instructions here</a>.', 'google-apps-login' ),
1206
- esc_url( $this->calculate_instructions_url( 'm' ) ) . '#multisite'
1207
- );
1208
  echo '</p>';
1209
  echo "<input id='input_ga_ms_usesubsitecallback' name='" . esc_attr( $this->get_options_name() ) . "[ga_ms_usesubsitecallback]' type='checkbox' " . ( $options['ga_ms_usesubsitecallback'] ? 'checked' : '' ) . " class='checkbox'/>";
1210
 
@@ -1244,13 +1227,13 @@ class Core_Google_Apps_Login {
1244
  );
1245
  }
1246
 
1247
- $newinput['ga_ms_usesubsitecallback'] = isset( $input['ga_ms_usesubsitecallback'] ) ? (bool) $input['ga_ms_usesubsitecallback'] : false;
1248
- $newinput['ga_force_permissions'] = isset( $input['ga_force_permissions'] ) ? (bool) $input['ga_force_permissions'] : false;
1249
- $newinput['ga_auto_login'] = isset( $input['ga_auto_login'] ) ? (bool) $input['ga_auto_login'] : false;
1250
- $newinput['ga_poweredby'] = isset( $input['ga_poweredby'] ) ? (bool) $input['ga_poweredby'] : false;
1251
- $newinput['ga_rememberme'] = isset( $input['ga_rememberme'] ) ? (bool) $input['ga_rememberme'] : false;
1252
- $newinput['btn_google_signin_image'] = isset( $input['btn_google_signin_image'] ) ? $input['btn_google_signin_image'] : 'btn_google_signin_dark_normal_web';
1253
- $newinput['ga_loginbuttontext'] = isset( $input['ga_loginbuttontext'] ) ? $input['ga_loginbuttontext'] : 'Login with Google';
1254
 
1255
  // Service account settings
1256
  $newinput['ga_domainadmin'] = isset( $input['ga_domainadmin'] ) ? trim( $input['ga_domainadmin'] ) : '';
@@ -1413,9 +1396,8 @@ class Core_Google_Apps_Login {
1413
  public function ga_save_network_options() {
1414
  check_admin_referer( $this->get_options_pagename() . '-options' );
1415
 
1416
- if ( isset( $_POST[ $this->get_options_name() ] ) && is_array( wp_unslash( $_POST[ $this->get_options_name() ] ) ) ) { // @codingStandardsIgnoreLine
1417
- $inoptions = wp_unslash( $_POST[ $this->get_options_name() ] ) ; // @codingStandardsIgnoreLine
1418
- $outoptions = $this->ga_options_validate( $inoptions );
1419
 
1420
  $error_code = array();
1421
  $error_setting = array();
@@ -1594,4 +1576,4 @@ class Core_Google_Apps_Login {
1594
 
1595
  }
1596
 
1597
- class GAL_Service_Exception extends Exception {} // @codingStandardsIgnoreLine
321
  public function ga_start_auth_get_url() {
322
  $options = $this->get_option_galogin();
323
  $clients = $this->create_google_client( $options );
 
324
  $client = $clients[0];
325
 
326
  // Generate a CSRF token
362
 
363
  if ( $do_autologin && '' !== $options['ga_clientid'] && '' !== $options['ga_clientsecret'] ) {
364
  if ( ! headers_sent() ) {
365
+ wp_redirect( esc_url_raw( $auth_url ) );
366
  exit;
367
  } else {
368
  ?>
369
+ <p><b><?php esc_html_e( 'Redirecting to', 'google-apps-login' ); ?><a href="<?php echo esc_url_raw( $auth_url ); ?>"><?php esc_html_e( 'Login via Google', 'google-apps-login' ); ?></a></b></p>
370
  <script type="text/javascript">
371
+ window.location = "<?php echo esc_url_raw( $auth_url ); ?>";
372
  </script>
373
  <?php
374
  }
378
  <?php
379
  if ( isset( $options['btn_google_signin_image'] ) && ! empty( $options['btn_google_signin_image'] ) && 'custom_text' !== $options['btn_google_signin_image'] ) {
380
  $login_with_google_image = $options['btn_google_signin_image'];
381
+ $login_with_google_button = '<a href="' . esc_url_raw( $auth_url ) . '">
382
  <span class="google-apps-header ' . $login_with_google_image . '">
383
  <span class="inner">
384
  <span class="icon ' . $login_with_google_image . '"></span>
398
  }
399
  ?>
400
  <p class="galogin" style="cursor: pointer;background: none;box-shadow: none;">
401
+ <?php echo wp_kses_post( $login_with_google_button ); ?>
402
  </p>
403
 
404
 
408
 
409
  <script>
410
  jQuery(document).ready(function(){
 
 
411
  var loginform = jQuery('#loginform,#front-login-form');
412
  var googlelink = jQuery('p.galogin');
413
  var poweredby = jQuery('p.galogin-powered');
425
  }
426
  loginform.prepend(googlelink);
427
 
 
 
 
 
428
  });
429
  </script>
430
  <?php
443
  $options = $this->get_option_galogin();
444
 
445
  if ( array_key_exists( 'redirect_to', $_REQUEST ) && sanitize_text_field( wp_unslash( $_REQUEST['redirect_to'] ) ) ) {
446
+ return esc_url_raw( wp_unslash( $_REQUEST['redirect_to'] ) );
447
  } elseif ( is_multisite() && ! $options['ga_ms_usesubsitecallback'] ) {
448
  return admin_url(); // This is what WordPress would choose as default
449
  // but we have to specify explicitly since all callbacks go via root site
450
  }
451
+ return '';
452
  }
453
 
454
  public function ga_authenticate( $user, $username = null, $password = null ) {
492
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Session mismatch - try again, but there could be a problem passing state', 'google-apps-login' ) );
493
  return $this->display_and_return_error( $user );
494
  }
495
+ $retnonce = sanitize_text_field( $statevars[0] );
496
+ $retredirectto = esc_url_raw( $statevars[1] );
497
 
498
  if ( ! $this->session_indep_verify_nonce( $retnonce, 'google_apps_login-' . $this->get_cookie_value() ) ) {
499
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Session mismatch - try again, but there could be a problem setting cookies', 'google-apps-login' ) );
502
 
503
  try {
504
  $clients = $this->create_google_client( $options, true );
 
505
  $client = $clients[0];
506
  $oauthservice = $clients[1];
507
 
513
  && property_exists( $userinfo, 'verifiedEmail' ) ) {
514
 
515
  $google_email = $userinfo->email;
516
+ $google_verified_email = $userinfo->verifiedEmail;
517
 
518
  if ( ! $google_verified_email ) {
519
  $user = new WP_Error( 'ga_login_error', esc_html__( 'Email needs to be verified on your Google Account', 'google-apps-login' ) );
574
 
575
  protected function display_and_return_error( $user ) {
576
  if ( is_wp_error( $user ) && get_bloginfo( 'version' ) < 3.7 ) {
577
+ // Only newer WordPress versions display errors from $user for us.
578
  global $error;
 
579
  $error = htmlentities2( $user->get_error_message() );
580
  }
581
  return $user;
898
 
899
  if ( isset( $_REQUEST['error_setting'] ) && is_array( $_REQUEST['error_setting'] )
900
  && isset( $_REQUEST['error_code'] ) && is_array( $_REQUEST['error_code'] ) ) {
901
+
902
+ if ( count( wp_unslash( $_REQUEST['error_code'] ) ) > 0 && count( wp_unslash( $_REQUEST['error_code'] ) ) === count( wp_unslash( $_REQUEST['error_setting'] ) ) ) {
903
+ $count = count( wp_unslash( $_REQUEST['error_code'] ) );
 
904
  for ( $i = 0; $i < $count; ++$i ) {
905
  ?>
906
  <div id="setting-error-settings_<?php echo esc_attr( $i ); ?>" class="error settings-error">
907
  <p>
908
+ <strong><?php echo esc_html( htmlentities2( $this->get_error_string( wp_unslash( $_REQUEST['error_setting'][ $i ] ) . '|' . wp_unslash( $_REQUEST['error_code'][ $i ] ) ) ) ); ?></strong>
909
  </p>
910
  </div>
911
  <?php
1072
  protected function ga_advancedsection_text() {
1073
  echo '<div id="advanced-section" class="galtab">';
1074
  echo '<p>';
1075
+ echo esc_html__( 'Once you have the plugin working, you can try these settings to customize the login flow for your users.', 'google-apps-login' ) . '&nbsp;<a href="' . esc_url( $this->calculate_instructions_url( 'a' ) ) . '#advanced' . '" target="gainstr">' . esc_html__( 'See instructions here', 'google-apps-login' ) . '</a>';
 
 
 
 
1076
  echo '</p>';
1077
 
1078
  $options = $this->get_option_galogin();
1187
 
1188
  if ( is_multisite() ) {
1189
  echo '<h3>' . esc_html__( 'Multisite Options', 'google-apps-login' ) . '</h3><p>';
1190
+ echo esc_html__( 'This setting is for multisite admins only. ', 'google-apps-login' ) . '<a href="' . esc_url( $this->calculate_instructions_url( 'm' ) ) . '#multisite' . '" target="gainstr">' . esc_html__( 'See instructions here', 'google-apps-login' ) . '</a>';
 
 
 
1191
  echo '</p>';
1192
  echo "<input id='input_ga_ms_usesubsitecallback' name='" . esc_attr( $this->get_options_name() ) . "[ga_ms_usesubsitecallback]' type='checkbox' " . ( $options['ga_ms_usesubsitecallback'] ? 'checked' : '' ) . " class='checkbox'/>";
1193
 
1227
  );
1228
  }
1229
 
1230
+ $newinput['ga_ms_usesubsitecallback'] = isset( $input['ga_ms_usesubsitecallback'] ) ? (bool) rest_sanitize_boolean( $input['ga_ms_usesubsitecallback'] ) : false;
1231
+ $newinput['ga_force_permissions'] = isset( $input['ga_force_permissions'] ) ? (bool) rest_sanitize_boolean( $input['ga_force_permissions'] ) : false;
1232
+ $newinput['ga_auto_login'] = isset( $input['ga_auto_login'] ) ? (bool) rest_sanitize_boolean( $input['ga_auto_login'] ) : false;
1233
+ $newinput['ga_poweredby'] = isset( $input['ga_poweredby'] ) ? (bool) rest_sanitize_boolean( $input['ga_poweredby'] ) : false;
1234
+ $newinput['ga_rememberme'] = isset( $input['ga_rememberme'] ) ? (bool) rest_sanitize_boolean( $input['ga_rememberme'] ) : false;
1235
+ $newinput['btn_google_signin_image'] = isset( $input['btn_google_signin_image'] ) ? sanitize_text_field( $input['btn_google_signin_image'] ) : 'btn_google_signin_dark_normal_web';
1236
+ $newinput['ga_loginbuttontext'] = isset( $input['ga_loginbuttontext'] ) ? sanitize_text_field( $input['ga_loginbuttontext'] ) : 'Login with Google';
1237
 
1238
  // Service account settings
1239
  $newinput['ga_domainadmin'] = isset( $input['ga_domainadmin'] ) ? trim( $input['ga_domainadmin'] ) : '';
1396
  public function ga_save_network_options() {
1397
  check_admin_referer( $this->get_options_pagename() . '-options' );
1398
 
1399
+ if ( isset( $_POST[ $this->get_options_name() ] ) && is_array( wp_unslash( $_POST[ $this->get_options_name() ] ) ) ) { // WPCS: XSS ok array sanitized when set in ga_options_validate
1400
+ $outoptions = $this->ga_options_validate( wp_unslash( $_POST[ $this->get_options_name() ] ) );
 
1401
 
1402
  $error_code = array();
1403
  $error_setting = array();
1576
 
1577
  }
1578
 
1579
+ class GAL_Service_Exception extends Exception {}
core/service_account_upgrade.php CHANGED
@@ -30,9 +30,12 @@ function gal_service_account_upgrade( &$option, $gal_option_name, &$existing_sa_
30
  if ( openssl_pkey_export( $privateKey, $pemString ) ) {
31
  $existing_sa_options['ga_sakey'] = $pemString;
32
  }
33
- openssl_pkey_free( $privateKey );
34
 
35
- @unlink( $options['ga_keyfilepath'] );
 
 
 
 
36
  }
37
  }
38
  }
30
  if ( openssl_pkey_export( $privateKey, $pemString ) ) {
31
  $existing_sa_options['ga_sakey'] = $pemString;
32
  }
 
33
 
34
+ if (PHP_MAJOR_VERSION < 8) {
35
+ openssl_pkey_free( $privateKey );
36
+ }
37
+
38
+ @unlink( $option['ga_keyfilepath'] );
39
  }
40
  }
41
  }
google_apps_login.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Login for Google Apps
4
  * Plugin URI: https://wp-glogin.com/
5
  * Description: Simple secure login for WordPress through users' Google Apps accounts (uses secure OAuth2, and MFA if enabled)
6
- * Version: 3.4.5
7
  * Author: WPGlogin Team
8
  * Author URI: https://wp-glogin.com/
9
  * License: GPL3
@@ -21,7 +21,7 @@ if ( class_exists( 'Core_Google_Apps_Login' ) ) {
21
 
22
  class Basic_Google_Apps_Login extends Core_Google_Apps_Login {
23
 
24
- protected $plugin_version = '3.4.5';
25
 
26
  /**
27
  * Singleton Var
@@ -81,46 +81,38 @@ class Basic_Google_Apps_Login extends Core_Google_Apps_Login {
81
  $avatarslink = 'https://wp-glogin.com/avatars/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=Avatars';
82
  $aioilink = 'https://wp-glogin.com/intranet/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=AIOI';
83
 
84
- $adverts = array();
 
 
85
 
86
- $adverts[] = '<div>'
87
  . '<a href="' . esc_url( $upgradelink ) . '" target="_blank">'
88
  . '<img alt="Login upgrade" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_loginupgrade.png" />'
89
  . '</a>'
90
  . '<span>Buy our <a href="' . esc_url( $upgradelink ) . '" target="_blank">premium Login plugin</a> to revolutionize user management</span>'
91
  . '</div>';
92
 
93
- $adverts[] = '<div>'
94
  . '<a href="' . esc_url( $drivelink ) . '" target="_blank">'
95
  . '<img alt="Google Drive Embedder Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_driveplugin.png" />'
96
  . '</a>'
97
  . '<span>Try our <a href="' . esc_url( $drivelink ) . '" target="_blank">Google Drive Embedder</a> plugin</span>'
98
  . '</div>';
99
 
100
- $adverts[] = '<div>'
101
  . '<a href="' . esc_url( $avatarslink ) . '" target="_blank">'
102
  . '<img alt="Google Profile Avatars Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_avatars.png" />'
103
  . '</a>'
104
  . '<span>Bring your site to life with <a href="' . esc_url( $avatarslink ) . '" target="_blank">Google Profile Avatars</a></span>'
105
  . '</div>';
106
 
107
- $adverts[] = '<div>'
108
  . '<a href="' . esc_url( $aioilink ) . '" target="_blank">'
109
  . '<img alt="All-In-One Intranet Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_aioi.png" />'
110
  . '</a>'
111
- . '<span>Instantly turn WordPress into a corporate intranet with <a href="' . $aioilink . '" target="_blank">All-In-One Intranet</a></span>'
112
  . '</div>';
113
 
114
- $startnum = (int) gmdate( 'j' );
115
-
116
- echo '<div id="gal-tableright" class="gal-tablecell">';
117
-
118
- $this->output_drip_form();
119
-
120
- for ( $i = 0; $i < 2; $i++ ) {
121
- echo $adverts[ ( $startnum + $i ) % 4 ]; // @codingStandardsIgnoreLine
122
- }
123
-
124
  echo '</div>';
125
 
126
  }
@@ -223,10 +215,7 @@ class Basic_Google_Apps_Login extends Core_Google_Apps_Login {
223
  $purchase_url = 'https://wp-glogin.com/glogin/?utm_source=User%20Pages&utm_medium=freemium&utm_campaign=Freemium';
224
  $nothanks_url = add_query_arg( 'google_apps_login_action', 'no_thanks' );
225
  echo '<div class="updated"><p>';
226
- echo sprintf(
227
- __( 'Completely forget about WordPress user management - upgrade to <a href="%s">Login for Google Apps Premium or Enterprise</a> to automatically sync users from your Google Apps domain', 'google-apps-login' ),
228
- esc_url( $purchase_url )
229
- );
230
  echo ' &nbsp; <a href="' . esc_url( $purchase_url ) . '" class="button-secondary">' . esc_html__( 'Find out more', 'google-apps-login' ) . '</a>';
231
  echo '&nbsp;<a href="' . esc_url( $nothanks_url ) . '" class="button-secondary">' . esc_html__( 'No Thanks', 'google-apps-login' ) . '</a>';
232
  echo '</p></div>';
3
  * Plugin Name: Login for Google Apps
4
  * Plugin URI: https://wp-glogin.com/
5
  * Description: Simple secure login for WordPress through users' Google Apps accounts (uses secure OAuth2, and MFA if enabled)
6
+ * Version: 3.4.6
7
  * Author: WPGlogin Team
8
  * Author URI: https://wp-glogin.com/
9
  * License: GPL3
21
 
22
  class Basic_Google_Apps_Login extends Core_Google_Apps_Login {
23
 
24
+ protected $plugin_version = '3.4.6';
25
 
26
  /**
27
  * Singleton Var
81
  $avatarslink = 'https://wp-glogin.com/avatars/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=Avatars';
82
  $aioilink = 'https://wp-glogin.com/intranet/?utm_source=Admin%20Sidebar&utm_medium=freemium&utm_campaign=AIOI';
83
 
84
+ echo '<div id="gal-tableright" class="gal-tablecell">';
85
+
86
+ $this->output_drip_form();
87
 
88
+ echo '<div>'
89
  . '<a href="' . esc_url( $upgradelink ) . '" target="_blank">'
90
  . '<img alt="Login upgrade" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_loginupgrade.png" />'
91
  . '</a>'
92
  . '<span>Buy our <a href="' . esc_url( $upgradelink ) . '" target="_blank">premium Login plugin</a> to revolutionize user management</span>'
93
  . '</div>';
94
 
95
+ echo '<div>'
96
  . '<a href="' . esc_url( $drivelink ) . '" target="_blank">'
97
  . '<img alt="Google Drive Embedder Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_driveplugin.png" />'
98
  . '</a>'
99
  . '<span>Try our <a href="' . esc_url( $drivelink ) . '" target="_blank">Google Drive Embedder</a> plugin</span>'
100
  . '</div>';
101
 
102
+ echo '<div>'
103
  . '<a href="' . esc_url( $avatarslink ) . '" target="_blank">'
104
  . '<img alt="Google Profile Avatars Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_avatars.png" />'
105
  . '</a>'
106
  . '<span>Bring your site to life with <a href="' . esc_url( $avatarslink ) . '" target="_blank">Google Profile Avatars</a></span>'
107
  . '</div>';
108
 
109
+ echo '<div>'
110
  . '<a href="' . esc_url( $aioilink ) . '" target="_blank">'
111
  . '<img alt="All-In-One Intranet Plugin" src="' . esc_url( $this->my_plugin_url() ) . 'img/basic_aioi.png" />'
112
  . '</a>'
113
+ . '<span>Instantly turn WordPress into a corporate intranet with <a href="' . esc_url( $aioilink ) . '" target="_blank">All-In-One Intranet</a></span>'
114
  . '</div>';
115
 
 
 
 
 
 
 
 
 
 
 
116
  echo '</div>';
117
 
118
  }
215
  $purchase_url = 'https://wp-glogin.com/glogin/?utm_source=User%20Pages&utm_medium=freemium&utm_campaign=Freemium';
216
  $nothanks_url = add_query_arg( 'google_apps_login_action', 'no_thanks' );
217
  echo '<div class="updated"><p>';
218
+ echo esc_html__( 'Completely forget about WordPress user management - upgrade to', 'google-apps-login' ) . '&nbsp;<a href="' . esc_url( $purchase_url ) . '">' . esc_html__( 'Login for Google Apps Premium or Enterprise', 'google-apps-login' ) . '</a>&nbsp;' . esc_html__( 'to automatically sync users from your Google Apps domain', 'google-apps-login' );
 
 
 
219
  echo ' &nbsp; <a href="' . esc_url( $purchase_url ) . '" class="button-secondary">' . esc_html__( 'Find out more', 'google-apps-login' ) . '</a>';
220
  echo '&nbsp;<a href="' . esc_url( $nothanks_url ) . '" class="button-secondary">' . esc_html__( 'No Thanks', 'google-apps-login' ) . '</a>';
221
  echo '</p></div>';
js/gal-admin.js CHANGED
@@ -1,114 +1,131 @@
1
-
2
- jQuery(document).ready(function() {
3
-
4
  function galSetActionToTab(id) {
5
  var frm = jQuery('#gal_form');
6
- frm.attr('action', frm.attr('action').replace(/(#.+)?$/, '#'+id) );
7
  }
8
 
9
- jQuery('#gal-tabs').find('a').click(function() {
 
 
10
  jQuery('#gal-tabs').find('a').removeClass('nav-tab-active');
11
  jQuery('.galtab').removeClass('active');
12
- var id = jQuery(this).attr('id').replace('-tab','');
13
  jQuery('#' + id + '-section').addClass('active');
14
  jQuery(this).addClass('nav-tab-active');
15
-
16
  // Set submit URL to this tab
17
  galSetActionToTab(id);
18
- });
19
-
20
  // Did page load with a tab active?
21
- var active_tab = window.location.hash.replace('#','');
22
- if ( active_tab != '') {
23
  var activeSection = jQuery('#' + active_tab + '-section');
24
  var activeTab = jQuery('#' + active_tab + '-tab');
25
-
26
  if (activeSection && activeTab) {
27
  jQuery('#gal-tabs').find('a').removeClass('nav-tab-active');
28
  jQuery('.galtab').removeClass('active');
29
-
30
  activeSection.addClass('active');
31
  activeTab.addClass('nav-tab-active');
32
  galSetActionToTab(active_tab);
33
  }
34
  }
35
-
36
  // JSON keyfile Browse for File <-> Textarea
37
- jQuery('a.gal_jsonkeyfile').on('click', function(e){
38
  jQuery('input#input_ga_keyfileupload').replaceWith(
39
- jQuery("<input type='file' name='ga_keyfileupload' id='input_ga_keyfileupload' class='gal_jsonkeyfile'/>")
 
 
40
  );
41
  jQuery('.gal_jsonkeyfile').hide();
42
  jQuery('.gal_jsonkeytext').show();
43
  e.preventDefault();
44
  });
45
- jQuery('a.gal_jsonkeytext').on('click', function(e){
46
  jQuery('.gal_jsonkeytext').hide();
47
  jQuery('.gal_jsonkeyfile').show();
48
  jQuery('textarea#input_ga_keyjson').val('');
49
  e.preventDefault();
50
  });
51
-
52
  // Dependent fields in premium
53
  // Default role only makes sense if Auto-create users is checked
54
- clickfn = function() {
55
- jQuery('#ga_defaultrole').prop('disabled', !jQuery('#input_ga_autocreate').is(':checked'));
 
 
 
56
  };
57
  jQuery('#input_ga_autocreate').on('click', clickfn);
58
  clickfn();
59
-
60
  // Only allow Completely hide WP login if Disable WP login for my domain is checked
61
- clickfn2 = function() {
62
- jQuery('#input_ga_hidewplogin').prop('disabled', !jQuery('#input_ga_disablewplogin').is(':checked'));
 
 
 
63
  };
64
  jQuery('#input_ga_disablewplogin').on('click', clickfn2);
65
  clickfn2();
66
-
67
  // Only bother with any domain-specific options if a domain has been entered
68
  if (jQuery('#input_ga_domainname').length > 0) {
69
- domainchangefn = function() {
70
  var domainname = jQuery('#input_ga_domainname').val().trim();
71
- jQuery('#domain-section input.gal_needsdomain').prop('disabled', domainname == '');
 
 
 
72
  };
73
  jQuery('#input_ga_domainname').on('change', domainchangefn);
74
  domainchangefn();
75
  }
76
-
77
  // Show service account button
78
- jQuery('#gal-show-admin-serviceacct').on('click', function(e) {
79
  jQuery('#gal-hide-admin-serviceacct').show();
80
  jQuery('#gal-show-admin-serviceacct').hide();
81
  e.preventDefault();
82
  });
83
-
84
  // Copy and paste click
85
  function selectText(element) {
86
- var range, selection;
87
-
88
- if (document.body.createTextRange) { //ms
89
- range = document.body.createTextRange();
90
- range.moveToElementText(element);
91
- range.select();
92
- } else if (window.getSelection) { //all others
93
- selection = window.getSelection();
94
- range = document.createRange();
95
- range.selectNodeContents(element);
96
- selection.removeAllRanges();
97
- selection.addRange(range);
98
- }
 
 
99
  }
100
- jQuery('.gal-admin-scopes-list').on('click', function(e) {
101
  selectText(e.target);
102
  });
103
 
104
  // Drip signup form in basic version
105
- jQuery('.gal-drip-signup-button').on('click', function(e) {
106
- jQuery('#gal-drip-signup-form').submit(function() {
107
- jQuery('#gal-drip-signup-form div').hide().after(jQuery('<div><p>Thank you!</p></div>'));
108
- // Mark WP user as signed up
109
- jQuery.post(ajaxurl, {action: 'gal_drip_submitted'}, function(response) {
110
-
111
- });
112
- });
 
 
 
 
113
  });
114
- });
1
+ jQuery(document).ready(function () {
 
 
2
  function galSetActionToTab(id) {
3
  var frm = jQuery('#gal_form');
4
+ frm.attr('action', frm.attr('action').replace(/(#.+)?$/, '#' + id));
5
  }
6
 
7
+ jQuery('#gal-tabs')
8
+ .find('a')
9
+ .click(function () {
10
  jQuery('#gal-tabs').find('a').removeClass('nav-tab-active');
11
  jQuery('.galtab').removeClass('active');
12
+ var id = jQuery(this).attr('id').replace('-tab', '');
13
  jQuery('#' + id + '-section').addClass('active');
14
  jQuery(this).addClass('nav-tab-active');
15
+
16
  // Set submit URL to this tab
17
  galSetActionToTab(id);
18
+ });
19
+
20
  // Did page load with a tab active?
21
+ var active_tab = window.location.hash.replace('#', '');
22
+ if (active_tab != '') {
23
  var activeSection = jQuery('#' + active_tab + '-section');
24
  var activeTab = jQuery('#' + active_tab + '-tab');
25
+
26
  if (activeSection && activeTab) {
27
  jQuery('#gal-tabs').find('a').removeClass('nav-tab-active');
28
  jQuery('.galtab').removeClass('active');
29
+
30
  activeSection.addClass('active');
31
  activeTab.addClass('nav-tab-active');
32
  galSetActionToTab(active_tab);
33
  }
34
  }
35
+
36
  // JSON keyfile Browse for File <-> Textarea
37
+ jQuery('a.gal_jsonkeyfile').on('click', function (e) {
38
  jQuery('input#input_ga_keyfileupload').replaceWith(
39
+ jQuery(
40
+ "<input type='file' name='ga_keyfileupload' id='input_ga_keyfileupload' class='gal_jsonkeyfile'/>",
41
+ ),
42
  );
43
  jQuery('.gal_jsonkeyfile').hide();
44
  jQuery('.gal_jsonkeytext').show();
45
  e.preventDefault();
46
  });
47
+ jQuery('a.gal_jsonkeytext').on('click', function (e) {
48
  jQuery('.gal_jsonkeytext').hide();
49
  jQuery('.gal_jsonkeyfile').show();
50
  jQuery('textarea#input_ga_keyjson').val('');
51
  e.preventDefault();
52
  });
53
+
54
  // Dependent fields in premium
55
  // Default role only makes sense if Auto-create users is checked
56
+ clickfn = function () {
57
+ jQuery('#ga_defaultrole').prop(
58
+ 'disabled',
59
+ !jQuery('#input_ga_autocreate').is(':checked'),
60
+ );
61
  };
62
  jQuery('#input_ga_autocreate').on('click', clickfn);
63
  clickfn();
64
+
65
  // Only allow Completely hide WP login if Disable WP login for my domain is checked
66
+ clickfn2 = function () {
67
+ jQuery('#input_ga_hidewplogin').prop(
68
+ 'disabled',
69
+ !jQuery('#input_ga_disablewplogin').is(':checked'),
70
+ );
71
  };
72
  jQuery('#input_ga_disablewplogin').on('click', clickfn2);
73
  clickfn2();
74
+
75
  // Only bother with any domain-specific options if a domain has been entered
76
  if (jQuery('#input_ga_domainname').length > 0) {
77
+ domainchangefn = function () {
78
  var domainname = jQuery('#input_ga_domainname').val().trim();
79
+ jQuery('#domain-section input.gal_needsdomain').prop(
80
+ 'disabled',
81
+ domainname == '',
82
+ );
83
  };
84
  jQuery('#input_ga_domainname').on('change', domainchangefn);
85
  domainchangefn();
86
  }
87
+
88
  // Show service account button
89
+ jQuery('#gal-show-admin-serviceacct').on('click', function (e) {
90
  jQuery('#gal-hide-admin-serviceacct').show();
91
  jQuery('#gal-show-admin-serviceacct').hide();
92
  e.preventDefault();
93
  });
94
+
95
  // Copy and paste click
96
  function selectText(element) {
97
+ var range, selection;
98
+
99
+ if (document.body.createTextRange) {
100
+ //ms
101
+ range = document.body.createTextRange();
102
+ range.moveToElementText(element);
103
+ range.select();
104
+ } else if (window.getSelection) {
105
+ //all others
106
+ selection = window.getSelection();
107
+ range = document.createRange();
108
+ range.selectNodeContents(element);
109
+ selection.removeAllRanges();
110
+ selection.addRange(range);
111
+ }
112
  }
113
+ jQuery('.gal-admin-scopes-list').on('click', function (e) {
114
  selectText(e.target);
115
  });
116
 
117
  // Drip signup form in basic version
118
+ jQuery('.gal-drip-signup-button').on('click', function (e) {
119
+ jQuery('#gal-drip-signup-form').submit(function () {
120
+ jQuery('#gal-drip-signup-form div')
121
+ .hide()
122
+ .after(jQuery('<div><p>Thank you!</p></div>'));
123
+ // Mark WP user as signed up
124
+ jQuery.post(
125
+ ajaxurl,
126
+ { action: 'gal_drip_submitted' },
127
+ function (response) {},
128
+ );
129
+ });
130
  });
131
+ });
readme.txt CHANGED
@@ -198,6 +198,10 @@ Personalized instructions to configure the plugin by registering your site with
198
  the WordPress admin panel once you have activated the plugin. For a (non-personalized) preview of these instructions please [click here](https://wp-glogin.com/installing-google-apps-login/basic-setup/).
199
 
200
  == Changelog ==
 
 
 
 
201
 
202
  = 3.4.5 =
203
 
198
  the WordPress admin panel once you have activated the plugin. For a (non-personalized) preview of these instructions please [click here](https://wp-glogin.com/installing-google-apps-login/basic-setup/).
199
 
200
  == Changelog ==
201
+ = 3.4.6 =
202
+ Fixed: Auth errors when redirect login is enabled
203
+ Removed: gal_login_form_readyjs filter.
204
+
205
 
206
  = 3.4.5 =
207