Google Authenticator - Version 0.43

Version Description

  • It's now possible for an admin to hide the Google Authenticaator settings on a per-user basis. (Feature request by : Skate-O)
Download this release

Release Info

Developer Henrik.Schack
Plugin Icon wp plugin Google Authenticator
Version 0.43
Comparing to
See all releases

Code changes from version 0.42 to 0.43

Files changed (2) hide show
  1. google-authenticator.php +32 -4
  2. readme.txt +8 -1
google-authenticator.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Google Authenticator
4
  Plugin URI: http://henrik.schack.dk/google-authenticator-for-wordpress
5
  Description: Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry app as One Time Password generator.
6
  Author: Henrik Schack
7
- Version: 0.42
8
  Author URI: http://henrik.schack.dk/
9
  Compatibility: WordPress 3.4.1
10
  Text Domain: google-authenticator
@@ -205,6 +205,10 @@ function check_otp( $user, $username = '', $password = '' ) {
205
  */
206
  function profile_personal_options() {
207
  global $user_id, $is_profile_page;
 
 
 
 
208
 
209
  $GA_secret = trim( get_user_option( 'googleauthenticator_secret', $user_id ) );
210
  $GA_enabled = trim( get_user_option( 'googleauthenticator_enabled', $user_id ) );
@@ -357,6 +361,11 @@ ENDOFJS;
357
  function personal_options_update() {
358
  global $user_id;
359
 
 
 
 
 
 
360
  $GA_enabled = ! empty( $_POST['GA_enabled'] );
361
  $GA_description = trim( $_POST['GA_description'] );
362
  $GA_relaxedmode = ! empty( $_POST['GA_relaxedmode'] );
@@ -404,16 +413,26 @@ function personal_options_update() {
404
  */
405
  function edit_user_profile() {
406
  global $user_id;
407
- $GA_enabled = trim( get_user_option( 'googleauthenticator_enabled', $user_id ) );
 
408
  echo "<h3>".__('Google Authenticator Settings','google-authenticator')."</h3>\n";
409
  echo "<table class=\"form-table\">\n";
410
  echo "<tbody>\n";
 
 
 
 
 
 
 
 
411
  echo "<tr>\n";
412
  echo "<th scope=\"row\">".__('Active','google-authenticator')."</th>\n";
413
  echo "<td>\n";
414
  echo "<div><input name=\"GA_enabled\" id=\"GA_enabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_enabled, 'enabled', false ) . "/>\n";
415
  echo "</td>\n";
416
  echo "</tr>\n";
 
417
  echo "</tbody>\n";
418
  echo "</table>\n";
419
  }
@@ -424,15 +443,24 @@ function edit_user_profile() {
424
  function edit_user_profile_update() {
425
  global $user_id;
426
 
427
- $GA_enabled = ! empty( $_POST['GA_enabled'] );
 
428
 
429
  if ( ! $GA_enabled ) {
430
  $GA_enabled = 'disabled';
431
  } else {
432
  $GA_enabled = 'enabled';
433
  }
434
-
 
 
 
 
 
 
435
  update_user_option( $user_id, 'googleauthenticator_enabled', $GA_enabled, true );
 
 
436
  }
437
 
438
 
4
  Plugin URI: http://henrik.schack.dk/google-authenticator-for-wordpress
5
  Description: Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry app as One Time Password generator.
6
  Author: Henrik Schack
7
+ Version: 0.43
8
  Author URI: http://henrik.schack.dk/
9
  Compatibility: WordPress 3.4.1
10
  Text Domain: google-authenticator
205
  */
206
  function profile_personal_options() {
207
  global $user_id, $is_profile_page;
208
+
209
+ // If editing of Google Authenticator settings has been disabled, just return
210
+ $GA_hidefromuser = trim( get_user_option( 'googleauthenticator_hidefromuser', $user_id ) );
211
+ if ( $GA_hidefromuser == 'enabled') return;
212
 
213
  $GA_secret = trim( get_user_option( 'googleauthenticator_secret', $user_id ) );
214
  $GA_enabled = trim( get_user_option( 'googleauthenticator_enabled', $user_id ) );
361
  function personal_options_update() {
362
  global $user_id;
363
 
364
+ // If editing of Google Authenticator settings has been disabled, just return
365
+ $GA_hidefromuser = trim( get_user_option( 'googleauthenticator_hidefromuser', $user_id ) );
366
+ if ( $GA_hidefromuser == 'enabled') return;
367
+
368
+
369
  $GA_enabled = ! empty( $_POST['GA_enabled'] );
370
  $GA_description = trim( $_POST['GA_description'] );
371
  $GA_relaxedmode = ! empty( $_POST['GA_relaxedmode'] );
413
  */
414
  function edit_user_profile() {
415
  global $user_id;
416
+ $GA_enabled = trim( get_user_option( 'googleauthenticator_enabled', $user_id ) );
417
+ $GA_hidefromuser = trim( get_user_option( 'googleauthenticator_hidefromuser', $user_id ) );
418
  echo "<h3>".__('Google Authenticator Settings','google-authenticator')."</h3>\n";
419
  echo "<table class=\"form-table\">\n";
420
  echo "<tbody>\n";
421
+
422
+ echo "<tr>\n";
423
+ echo "<th scope=\"row\">".__('Hide settings from user','google-authenticator')."</th>\n";
424
+ echo "<td>\n";
425
+ echo "<div><input name=\"GA_hidefromuser\" id=\"GA_hidefromuser\" class=\"tog\" type=\"checkbox\"" . checked( $GA_hidefromuser, 'enabled', false ) . "/>\n";
426
+ echo "</td>\n";
427
+ echo "</tr>\n";
428
+
429
  echo "<tr>\n";
430
  echo "<th scope=\"row\">".__('Active','google-authenticator')."</th>\n";
431
  echo "<td>\n";
432
  echo "<div><input name=\"GA_enabled\" id=\"GA_enabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_enabled, 'enabled', false ) . "/>\n";
433
  echo "</td>\n";
434
  echo "</tr>\n";
435
+
436
  echo "</tbody>\n";
437
  echo "</table>\n";
438
  }
443
  function edit_user_profile_update() {
444
  global $user_id;
445
 
446
+ $GA_enabled = ! empty( $_POST['GA_enabled'] );
447
+ $GA_hidefromuser = ! empty( $_POST['GA_hidefromuser'] );
448
 
449
  if ( ! $GA_enabled ) {
450
  $GA_enabled = 'disabled';
451
  } else {
452
  $GA_enabled = 'enabled';
453
  }
454
+
455
+ if ( ! $GA_hidefromuser ) {
456
+ $GA_hidefromuser = 'disabled';
457
+ } else {
458
+ $GA_hidefromuser = 'enabled';
459
+ }
460
+
461
  update_user_option( $user_id, 'googleauthenticator_enabled', $GA_enabled, true );
462
+ update_user_option( $user_id, 'googleauthenticator_hidefromuser', $GA_hidefromuser, true );
463
+
464
  }
465
 
466
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=henri
4
  Tags: authentication,otp,password,security,login,android,iphone,blackberry
5
  Requires at least: 3.1.2
6
  Tested up to: 3.4.1
7
- Stable tag: 0.42
8
 
9
  Google Authenticator for your WordPress blog.
10
 
@@ -49,6 +49,10 @@ If you have an Android phone, you can use an app like [ClockSync](https://market
49
 
50
  Another option is to enable "relaxed mode" in the settings for the plugin, this will enable more valid codes by allowing up to a 4 min. timedrift in each direction.
51
 
 
 
 
 
52
  == Screenshots ==
53
 
54
  1. The enhanced log-in box.
@@ -58,6 +62,9 @@ Another option is to enable "relaxed mode" in the settings for the plugin, this
58
 
59
  == Changelog ==
60
 
 
 
 
61
  = 0.42 =
62
  * Autocomplete disabled on code input field. (Feature request by : hiphopsmurf)
63
 
4
  Tags: authentication,otp,password,security,login,android,iphone,blackberry
5
  Requires at least: 3.1.2
6
  Tested up to: 3.4.1
7
+ Stable tag: 0.43
8
 
9
  Google Authenticator for your WordPress blog.
10
 
49
 
50
  Another option is to enable "relaxed mode" in the settings for the plugin, this will enable more valid codes by allowing up to a 4 min. timedrift in each direction.
51
 
52
+ = I have several users on my WordPress installation, is that a supported configuration ? =
53
+
54
+ Yes, each user has his own Google Authenticator settings.
55
+
56
  == Screenshots ==
57
 
58
  1. The enhanced log-in box.
62
 
63
  == Changelog ==
64
 
65
+ = 0.43 =
66
+ * It's now possible for an admin to hide the Google Authenticaator settings on a per-user basis. (Feature request by : Skate-O)
67
+
68
  = 0.42 =
69
  * Autocomplete disabled on code input field. (Feature request by : hiphopsmurf)
70