Google Authenticator - Version 0.50

Version Description

  • New maintainer ivankk
  • Conditionally include base32 class
Download this release

Release Info

Developer ivankk
Plugin Icon wp plugin Google Authenticator
Version 0.50
Comparing to
See all releases

Code changes from version 0.48 to 0.50

Files changed (4) hide show
  1. LICENSE +339 -0
  2. google-authenticator.php +527 -68
  3. lang/google-authenticator.pot +184 -36
  4. readme.txt +20 -6
LICENSE ADDED
@@ -0,0 +1,339 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 2, June 1991
3
+
4
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6
+ Everyone is permitted to copy and distribute verbatim copies
7
+ of this license document, but changing it is not allowed.
8
+
9
+ Preamble
10
+
11
+ The licenses for most software are designed to take away your
12
+ freedom to share and change it. By contrast, the GNU General Public
13
+ License is intended to guarantee your freedom to share and change free
14
+ software--to make sure the software is free for all its users. This
15
+ General Public License applies to most of the Free Software
16
+ Foundation's software and to any other program whose authors commit to
17
+ using it. (Some other Free Software Foundation software is covered by
18
+ the GNU Lesser General Public License instead.) You can apply it to
19
+ your programs, too.
20
+
21
+ When we speak of free software, we are referring to freedom, not
22
+ price. Our General Public Licenses are designed to make sure that you
23
+ have the freedom to distribute copies of free software (and charge for
24
+ this service if you wish), that you receive source code or can get it
25
+ if you want it, that you can change the software or use pieces of it
26
+ in new free programs; and that you know you can do these things.
27
+
28
+ To protect your rights, we need to make restrictions that forbid
29
+ anyone to deny you these rights or to ask you to surrender the rights.
30
+ These restrictions translate to certain responsibilities for you if you
31
+ distribute copies of the software, or if you modify it.
32
+
33
+ For example, if you distribute copies of such a program, whether
34
+ gratis or for a fee, you must give the recipients all the rights that
35
+ you have. You must make sure that they, too, receive or can get the
36
+ source code. And you must show them these terms so they know their
37
+ rights.
38
+
39
+ We protect your rights with two steps: (1) copyright the software, and
40
+ (2) offer you this license which gives you legal permission to copy,
41
+ distribute and/or modify the software.
42
+
43
+ Also, for each author's protection and ours, we want to make certain
44
+ that everyone understands that there is no warranty for this free
45
+ software. If the software is modified by someone else and passed on, we
46
+ want its recipients to know that what they have is not the original, so
47
+ that any problems introduced by others will not reflect on the original
48
+ authors' reputations.
49
+
50
+ Finally, any free program is threatened constantly by software
51
+ patents. We wish to avoid the danger that redistributors of a free
52
+ program will individually obtain patent licenses, in effect making the
53
+ program proprietary. To prevent this, we have made it clear that any
54
+ patent must be licensed for everyone's free use or not licensed at all.
55
+
56
+ The precise terms and conditions for copying, distribution and
57
+ modification follow.
58
+
59
+ GNU GENERAL PUBLIC LICENSE
60
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61
+
62
+ 0. This License applies to any program or other work which contains
63
+ a notice placed by the copyright holder saying it may be distributed
64
+ under the terms of this General Public License. The "Program", below,
65
+ refers to any such program or work, and a "work based on the Program"
66
+ means either the Program or any derivative work under copyright law:
67
+ that is to say, a work containing the Program or a portion of it,
68
+ either verbatim or with modifications and/or translated into another
69
+ language. (Hereinafter, translation is included without limitation in
70
+ the term "modification".) Each licensee is addressed as "you".
71
+
72
+ Activities other than copying, distribution and modification are not
73
+ covered by this License; they are outside its scope. The act of
74
+ running the Program is not restricted, and the output from the Program
75
+ is covered only if its contents constitute a work based on the
76
+ Program (independent of having been made by running the Program).
77
+ Whether that is true depends on what the Program does.
78
+
79
+ 1. You may copy and distribute verbatim copies of the Program's
80
+ source code as you receive it, in any medium, provided that you
81
+ conspicuously and appropriately publish on each copy an appropriate
82
+ copyright notice and disclaimer of warranty; keep intact all the
83
+ notices that refer to this License and to the absence of any warranty;
84
+ and give any other recipients of the Program a copy of this License
85
+ along with the Program.
86
+
87
+ You may charge a fee for the physical act of transferring a copy, and
88
+ you may at your option offer warranty protection in exchange for a fee.
89
+
90
+ 2. You may modify your copy or copies of the Program or any portion
91
+ of it, thus forming a work based on the Program, and copy and
92
+ distribute such modifications or work under the terms of Section 1
93
+ above, provided that you also meet all of these conditions:
94
+
95
+ a) You must cause the modified files to carry prominent notices
96
+ stating that you changed the files and the date of any change.
97
+
98
+ b) You must cause any work that you distribute or publish, that in
99
+ whole or in part contains or is derived from the Program or any
100
+ part thereof, to be licensed as a whole at no charge to all third
101
+ parties under the terms of this License.
102
+
103
+ c) If the modified program normally reads commands interactively
104
+ when run, you must cause it, when started running for such
105
+ interactive use in the most ordinary way, to print or display an
106
+ announcement including an appropriate copyright notice and a
107
+ notice that there is no warranty (or else, saying that you provide
108
+ a warranty) and that users may redistribute the program under
109
+ these conditions, and telling the user how to view a copy of this
110
+ License. (Exception: if the Program itself is interactive but
111
+ does not normally print such an announcement, your work based on
112
+ the Program is not required to print an announcement.)
113
+
114
+ These requirements apply to the modified work as a whole. If
115
+ identifiable sections of that work are not derived from the Program,
116
+ and can be reasonably considered independent and separate works in
117
+ themselves, then this License, and its terms, do not apply to those
118
+ sections when you distribute them as separate works. But when you
119
+ distribute the same sections as part of a whole which is a work based
120
+ on the Program, the distribution of the whole must be on the terms of
121
+ this License, whose permissions for other licensees extend to the
122
+ entire whole, and thus to each and every part regardless of who wrote it.
123
+
124
+ Thus, it is not the intent of this section to claim rights or contest
125
+ your rights to work written entirely by you; rather, the intent is to
126
+ exercise the right to control the distribution of derivative or
127
+ collective works based on the Program.
128
+
129
+ In addition, mere aggregation of another work not based on the Program
130
+ with the Program (or with a work based on the Program) on a volume of
131
+ a storage or distribution medium does not bring the other work under
132
+ the scope of this License.
133
+
134
+ 3. You may copy and distribute the Program (or a work based on it,
135
+ under Section 2) in object code or executable form under the terms of
136
+ Sections 1 and 2 above provided that you also do one of the following:
137
+
138
+ a) Accompany it with the complete corresponding machine-readable
139
+ source code, which must be distributed under the terms of Sections
140
+ 1 and 2 above on a medium customarily used for software interchange; or,
141
+
142
+ b) Accompany it with a written offer, valid for at least three
143
+ years, to give any third party, for a charge no more than your
144
+ cost of physically performing source distribution, a complete
145
+ machine-readable copy of the corresponding source code, to be
146
+ distributed under the terms of Sections 1 and 2 above on a medium
147
+ customarily used for software interchange; or,
148
+
149
+ c) Accompany it with the information you received as to the offer
150
+ to distribute corresponding source code. (This alternative is
151
+ allowed only for noncommercial distribution and only if you
152
+ received the program in object code or executable form with such
153
+ an offer, in accord with Subsection b above.)
154
+
155
+ The source code for a work means the preferred form of the work for
156
+ making modifications to it. For an executable work, complete source
157
+ code means all the source code for all modules it contains, plus any
158
+ associated interface definition files, plus the scripts used to
159
+ control compilation and installation of the executable. However, as a
160
+ special exception, the source code distributed need not include
161
+ anything that is normally distributed (in either source or binary
162
+ form) with the major components (compiler, kernel, and so on) of the
163
+ operating system on which the executable runs, unless that component
164
+ itself accompanies the executable.
165
+
166
+ If distribution of executable or object code is made by offering
167
+ access to copy from a designated place, then offering equivalent
168
+ access to copy the source code from the same place counts as
169
+ distribution of the source code, even though third parties are not
170
+ compelled to copy the source along with the object code.
171
+
172
+ 4. You may not copy, modify, sublicense, or distribute the Program
173
+ except as expressly provided under this License. Any attempt
174
+ otherwise to copy, modify, sublicense or distribute the Program is
175
+ void, and will automatically terminate your rights under this License.
176
+ However, parties who have received copies, or rights, from you under
177
+ this License will not have their licenses terminated so long as such
178
+ parties remain in full compliance.
179
+
180
+ 5. You are not required to accept this License, since you have not
181
+ signed it. However, nothing else grants you permission to modify or
182
+ distribute the Program or its derivative works. These actions are
183
+ prohibited by law if you do not accept this License. Therefore, by
184
+ modifying or distributing the Program (or any work based on the
185
+ Program), you indicate your acceptance of this License to do so, and
186
+ all its terms and conditions for copying, distributing or modifying
187
+ the Program or works based on it.
188
+
189
+ 6. Each time you redistribute the Program (or any work based on the
190
+ Program), the recipient automatically receives a license from the
191
+ original licensor to copy, distribute or modify the Program subject to
192
+ these terms and conditions. You may not impose any further
193
+ restrictions on the recipients' exercise of the rights granted herein.
194
+ You are not responsible for enforcing compliance by third parties to
195
+ this License.
196
+
197
+ 7. If, as a consequence of a court judgment or allegation of patent
198
+ infringement or for any other reason (not limited to patent issues),
199
+ conditions are imposed on you (whether by court order, agreement or
200
+ otherwise) that contradict the conditions of this License, they do not
201
+ excuse you from the conditions of this License. If you cannot
202
+ distribute so as to satisfy simultaneously your obligations under this
203
+ License and any other pertinent obligations, then as a consequence you
204
+ may not distribute the Program at all. For example, if a patent
205
+ license would not permit royalty-free redistribution of the Program by
206
+ all those who receive copies directly or indirectly through you, then
207
+ the only way you could satisfy both it and this License would be to
208
+ refrain entirely from distribution of the Program.
209
+
210
+ If any portion of this section is held invalid or unenforceable under
211
+ any particular circumstance, the balance of the section is intended to
212
+ apply and the section as a whole is intended to apply in other
213
+ circumstances.
214
+
215
+ It is not the purpose of this section to induce you to infringe any
216
+ patents or other property right claims or to contest validity of any
217
+ such claims; this section has the sole purpose of protecting the
218
+ integrity of the free software distribution system, which is
219
+ implemented by public license practices. Many people have made
220
+ generous contributions to the wide range of software distributed
221
+ through that system in reliance on consistent application of that
222
+ system; it is up to the author/donor to decide if he or she is willing
223
+ to distribute software through any other system and a licensee cannot
224
+ impose that choice.
225
+
226
+ This section is intended to make thoroughly clear what is believed to
227
+ be a consequence of the rest of this License.
228
+
229
+ 8. If the distribution and/or use of the Program is restricted in
230
+ certain countries either by patents or by copyrighted interfaces, the
231
+ original copyright holder who places the Program under this License
232
+ may add an explicit geographical distribution limitation excluding
233
+ those countries, so that distribution is permitted only in or among
234
+ countries not thus excluded. In such case, this License incorporates
235
+ the limitation as if written in the body of this License.
236
+
237
+ 9. The Free Software Foundation may publish revised and/or new versions
238
+ of the General Public License from time to time. Such new versions will
239
+ be similar in spirit to the present version, but may differ in detail to
240
+ address new problems or concerns.
241
+
242
+ Each version is given a distinguishing version number. If the Program
243
+ specifies a version number of this License which applies to it and "any
244
+ later version", you have the option of following the terms and conditions
245
+ either of that version or of any later version published by the Free
246
+ Software Foundation. If the Program does not specify a version number of
247
+ this License, you may choose any version ever published by the Free Software
248
+ Foundation.
249
+
250
+ 10. If you wish to incorporate parts of the Program into other free
251
+ programs whose distribution conditions are different, write to the author
252
+ to ask for permission. For software which is copyrighted by the Free
253
+ Software Foundation, write to the Free Software Foundation; we sometimes
254
+ make exceptions for this. Our decision will be guided by the two goals
255
+ of preserving the free status of all derivatives of our free software and
256
+ of promoting the sharing and reuse of software generally.
257
+
258
+ NO WARRANTY
259
+
260
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261
+ FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262
+ OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263
+ PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264
+ OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265
+ MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266
+ TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268
+ REPAIR OR CORRECTION.
269
+
270
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272
+ REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273
+ INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274
+ OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275
+ TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276
+ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277
+ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278
+ POSSIBILITY OF SUCH DAMAGES.
279
+
280
+ END OF TERMS AND CONDITIONS
281
+
282
+ How to Apply These Terms to Your New Programs
283
+
284
+ If you develop a new program, and you want it to be of the greatest
285
+ possible use to the public, the best way to achieve this is to make it
286
+ free software which everyone can redistribute and change under these terms.
287
+
288
+ To do so, attach the following notices to the program. It is safest
289
+ to attach them to the start of each source file to most effectively
290
+ convey the exclusion of warranty; and each file should have at least
291
+ the "copyright" line and a pointer to where the full notice is found.
292
+
293
+ <one line to give the program's name and a brief idea of what it does.>
294
+ Copyright (C) <year> <name of author>
295
+
296
+ This program is free software; you can redistribute it and/or modify
297
+ it under the terms of the GNU General Public License as published by
298
+ the Free Software Foundation; either version 2 of the License, or
299
+ (at your option) any later version.
300
+
301
+ This program is distributed in the hope that it will be useful,
302
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
303
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304
+ GNU General Public License for more details.
305
+
306
+ You should have received a copy of the GNU General Public License along
307
+ with this program; if not, write to the Free Software Foundation, Inc.,
308
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309
+
310
+ Also add information on how to contact you by electronic and paper mail.
311
+
312
+ If the program is interactive, make it output a short notice like this
313
+ when it starts in an interactive mode:
314
+
315
+ Gnomovision version 69, Copyright (C) year name of author
316
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317
+ This is free software, and you are welcome to redistribute it
318
+ under certain conditions; type `show c' for details.
319
+
320
+ The hypothetical commands `show w' and `show c' should show the appropriate
321
+ parts of the General Public License. Of course, the commands you use may
322
+ be called something other than `show w' and `show c'; they could even be
323
+ mouse-clicks or menu items--whatever suits your program.
324
+
325
+ You should also get your employer (if you work as a programmer) or your
326
+ school, if any, to sign a "copyright disclaimer" for the program, if
327
+ necessary. Here is a sample; alter the names:
328
+
329
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
331
+
332
+ <signature of Ty Coon>, 1 April 1989
333
+ Ty Coon, President of Vice
334
+
335
+ This General Public License does not permit incorporating your program into
336
+ proprietary programs. If your program is a subroutine library, you may
337
+ consider it more useful to permit linking proprietary applications with the
338
+ library. If this is what you want to do, use the GNU Lesser General
339
+ Public License instead of this License.
google-authenticator.php CHANGED
@@ -1,19 +1,21 @@
1
  <?php
2
  /*
3
  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.48
8
- Author URI: http://henrik.schack.dk/
9
- Compatibility: WordPress 4.5
10
  Text Domain: google-authenticator
11
  Domain Path: /lang
12
 
13
  ----------------------------------------------------------------------------
14
 
 
 
15
  Thanks to Bryan Ruiz for his Base32 encode/decode class, found at php.net.
16
- Thanks to Tobias B�thge for his major code rewrite and German translation.
17
  Thanks to Pascal de Bruijn for his relaxed mode idea.
18
  Thanks to Daniel Werl for his usability tips.
19
  Thanks to Dion Hulse for his bugfixes.
@@ -22,30 +24,36 @@ Domain Path: /lang
22
  Thanks to Ian Dunn for fixing some depricated function calls.
23
  Thanks to Kimmo Suominen for fixing the iPhone description issue.
24
  Thanks to Alex Concha for some security tips.
25
- Thanks to S�bastien Prunier for his Spanish and French translations.
26
 
27
  ----------------------------------------------------------------------------
28
 
29
- Copyright 2013 Henrik Schack (email : henrik@schack.dk)
 
30
 
31
- This program is free software; you can redistribute it and/or modify
32
- it under the terms of the GNU General Public License as published by
33
- the Free Software Foundation; either version 2 of the License, or
34
- (at your option) any later version.
35
 
36
- This program is distributed in the hope that it will be useful,
37
- but WITHOUT ANY WARRANTY; without even the implied warranty of
38
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
39
- GNU General Public License for more details.
40
 
41
- You should have received a copy of the GNU General Public License
42
- along with this program; if not, write to the Free Software
43
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
 
 
 
 
44
  */
45
 
46
  class GoogleAuthenticator {
47
 
48
  static $instance; // to store a reference to the plugin, allows other plugins to remove actions
 
 
49
 
50
  /**
51
  * Constructor, entry point of the plugin
@@ -59,10 +67,15 @@ function __construct() {
59
  * Initialization, Hooks, and localization
60
  */
61
  function init() {
62
- require_once( 'base32.php' );
63
-
64
- add_action( 'login_form', array( $this, 'loginform' ) );
65
- add_action( 'login_footer', array( $this, 'loginfooter' ) );
 
 
 
 
 
66
  add_filter( 'authenticate', array( $this, 'check_otp' ), 50, 3 );
67
 
68
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
@@ -74,36 +87,51 @@ function init() {
74
  add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
75
  add_action( 'edit_user_profile_update', array( $this, 'edit_user_profile_update' ) );
76
 
77
- add_action('admin_enqueue_scripts', array($this, 'add_qrcode_script'));
 
 
 
 
 
78
 
79
  load_plugin_textdomain( 'google-authenticator', false, basename( dirname( __FILE__ ) ) . '/lang' );
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
  /**
84
  * Check the verification code entered by the user.
85
  */
86
- function verify( $secretkey, $thistry, $relaxedmode, $lasttimeslot ) {
87
 
 
88
  // Did the user enter 6 digits ?
89
  if ( strlen( $thistry ) != 6) {
90
  return false;
91
  } else {
92
  $thistry = intval ( $thistry );
93
  }
94
-
95
  // If user is running in relaxed mode, we allow more time drifting
96
- // 4 min, as opposed to 30 seconds in normal mode.
97
  if ( $relaxedmode == 'enabled' ) {
98
  $firstcount = -8;
99
- $lastcount = 8;
100
  } else {
101
  $firstcount = -1;
102
- $lastcount = 1;
103
  }
104
-
105
  $tm = floor( time() / 30 );
106
-
107
  $secretkey=Base32::decode($secretkey);
108
  // Keys from 30 seconds before and after are valid aswell.
109
  for ($i=$firstcount; $i<=$lastcount; $i++) {
@@ -160,13 +188,359 @@ function add_qrcode_script() {
160
  wp_enqueue_script('qrcode_script');
161
  }
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  /**
164
  * Add verification code field to login form.
165
  */
166
  function loginform() {
167
  echo "\t<p>\n";
168
  echo "\t\t<label title=\"".__('If you don\'t have Google Authenticator enabled for your WordPress account, leave this field empty.','google-authenticator')."\">".__('Google Authenticator code','google-authenticator')."<span id=\"google-auth-info\"></span><br />\n";
169
- echo "\t\t<input type=\"text\" name=\"googleotp\" id=\"user_email\" class=\"input\" value=\"\" size=\"20\" style=\"ime-mode: inactive;\" /></label>\n";
170
  echo "\t</p>\n";
171
  }
172
 
@@ -184,10 +558,14 @@ function loginfooter() {
184
  /**
185
  * Login form handling.
186
  * Check Google Authenticator verification code, if user has been setup to do so.
187
- * @param wordpressuser
188
  * @return user/loginstatus
189
  */
190
  function check_otp( $user, $username = '', $password = '' ) {
 
 
 
 
191
  // Store result of loginprocess, so far.
192
  $userstate = $user;
193
 
@@ -237,8 +615,14 @@ function check_otp( $user, $username = '', $password = '' ) {
237
  return new WP_Error( 'invalid_google_authenticator_password', __( '<strong>ERROR</strong>: The Google Authenticator password is incorrect.', 'google-authenticator' ) );
238
  }
239
  } else {
240
- return new WP_Error( 'invalid_google_authenticator_token', __( '<strong>ERROR</strong>: The Google Authenticator code is incorrect or has expired.', 'google-authenticator' ) );
241
- }
 
 
 
 
 
 
242
  }
243
  }
244
  // Google Authenticator isn't enabled for this account,
@@ -246,12 +630,55 @@ function check_otp( $user, $username = '', $password = '' ) {
246
  return $userstate;
247
  }
248
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
249
 
250
  /**
251
  * Extend personal profile page with Google Authenticator settings.
252
  */
253
- function profile_personal_options() {
254
- global $user_id, $is_profile_page;
 
 
 
 
 
 
 
 
 
 
 
 
 
255
 
256
  // If editing of Google Authenticator settings has been disabled, just return
257
  $GA_hidefromuser = trim( get_user_option( 'googleauthenticator_hidefromuser', $user_id ) );
@@ -270,65 +697,86 @@ function profile_personal_options() {
270
  $GA_password = "XXXX XXXX XXXX XXXX";
271
  }
272
 
273
- // In case the user has no secret ready (new install), we create one.
274
  if ( '' == $GA_secret ) {
275
- $GA_secret = $this->create_secret();
276
  }
277
 
278
- // Use "WordPress Blog" as default description
279
  if ( '' == $GA_description ) {
280
- $GA_description = __( 'WordPressBlog', 'google-authenticator' );
 
 
 
 
 
 
281
  }
282
 
283
  echo "<h3>".__( 'Google Authenticator Settings', 'google-authenticator' )."</h3>\n";
284
 
285
  echo "<table class=\"form-table\">\n";
286
  echo "<tbody>\n";
287
- echo "<tr>\n";
288
- echo "<th scope=\"row\">".__( 'Active', 'google-authenticator' )."</th>\n";
289
- echo "<td>\n";
290
- echo "<input name=\"GA_enabled\" id=\"GA_enabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_enabled, 'enabled', false ) . "/>\n";
291
- echo "</td>\n";
292
- echo "</tr>\n";
293
 
294
- if ( $is_profile_page || IS_PROFILE_PAGE ) {
295
  echo "<tr>\n";
296
- echo "<th scope=\"row\">".__( 'Relaxed mode', 'google-authenticator' )."</th>\n";
297
  echo "<td>\n";
298
- echo "<input name=\"GA_relaxedmode\" id=\"GA_relaxedmode\" class=\"tog\" type=\"checkbox\"" . checked( $GA_relaxedmode, 'enabled', false ) . "/><span class=\"description\">".__(' Relaxed mode allows for more time drifting on your phone clock (&#177;4 min).','google-authenticator')."</span>\n";
299
  echo "</td>\n";
300
  echo "</tr>\n";
301
-
302
- echo "<tr>\n";
303
- echo "<th><label for=\"GA_description\">".__('Description','google-authenticator')."</label></th>\n";
304
- echo "<td><input name=\"GA_description\" id=\"GA_description\" value=\"{$GA_description}\" type=\"text\" size=\"25\" /><span class=\"description\">".__(' Description that you\'ll see in the Google Authenticator app on your phone.','google-authenticator')."</span><br /></td>\n";
305
- echo "</tr>\n";
306
 
 
307
  echo "<tr>\n";
308
- echo "<th><label for=\"GA_secret\">".__('Secret','google-authenticator')."</label></th>\n";
309
  echo "<td>\n";
310
- echo "<input name=\"GA_secret\" id=\"GA_secret\" value=\"{$GA_secret}\" readonly=\"readonly\" type=\"text\" size=\"25\" />";
311
- echo "<input name=\"GA_newsecret\" id=\"GA_newsecret\" value=\"".__("Create new secret",'google-authenticator')."\" type=\"button\" class=\"button\" />";
312
- echo "<input name=\"show_qr\" id=\"show_qr\" value=\"".__("Show/Hide QR code",'google-authenticator')."\" type=\"button\" class=\"button\" onclick=\"ShowOrHideQRCode();\" />";
313
  echo "</td>\n";
314
  echo "</tr>\n";
 
315
 
316
- echo "<tr>\n";
317
- echo "<th></th>\n";
318
- echo "<td><div id=\"GA_QR_INFO\" style=\"display: none\" >";
319
- echo "<div id=\"GA_QRCODE\"/></div>";
 
320
 
321
- echo '<span class="description"><br/> ' . __( 'Scan this with the Google Authenticator app.', 'google-authenticator' ) . '</span>';
322
- echo "</div></td>\n";
323
- echo "</tr>\n";
 
 
 
 
 
 
 
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  echo "<tr>\n";
326
  echo "<th scope=\"row\">".__( 'Enable App password', 'google-authenticator' )."</th>\n";
327
  echo "<td>\n";
328
  echo "<input name=\"GA_pwdenabled\" id=\"GA_pwdenabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_pwdenabled, 'enabled', false ) . "/><span class=\"description\">".__(' Enabling an App password will decrease your overall login security.','google-authenticator')."</span>\n";
329
  echo "</td>\n";
330
  echo "</tr>\n";
331
-
332
  echo "<tr>\n";
333
  echo "<th></th>\n";
334
  echo "<td>\n";
@@ -339,7 +787,18 @@ function profile_personal_options() {
339
  echo "</tr>\n";
340
  }
341
 
 
 
 
 
 
 
 
 
342
  echo "</tbody></table>\n";
 
 
 
343
  echo "<script type=\"text/javascript\">\n";
344
  echo "var GAnonce='".wp_create_nonce('GoogleAuthenticatoraction')."';\n";
345
 
@@ -546,4 +1005,4 @@ function ajax_callback() {
546
  } // end class
547
 
548
  $google_authenticator = new GoogleAuthenticator;
549
- ?>
1
  <?php
2
  /*
3
  Plugin Name: Google Authenticator
4
+ Plugin URI: https://github.com/ivankruchkoff/google-authenticator
5
  Description: Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry app as One Time Password generator.
6
+ Author: Ivan Kruchkoff
7
+ Version: 0.50
8
+ Author URI: https://github.com/ivankruchkoff
9
+ Compatibility: WordPress 5.1
10
  Text Domain: google-authenticator
11
  Domain Path: /lang
12
 
13
  ----------------------------------------------------------------------------
14
 
15
+ Thanks to Henrik Schack for creating / maintaining versions 0.20 to 0.48
16
+ Thanks to Ivan Kruchkoff for his UX improvements in user signup.
17
  Thanks to Bryan Ruiz for his Base32 encode/decode class, found at php.net.
18
+ Thanks to Tobias Bäthge for his major code rewrite and German translation.
19
  Thanks to Pascal de Bruijn for his relaxed mode idea.
20
  Thanks to Daniel Werl for his usability tips.
21
  Thanks to Dion Hulse for his bugfixes.
24
  Thanks to Ian Dunn for fixing some depricated function calls.
25
  Thanks to Kimmo Suominen for fixing the iPhone description issue.
26
  Thanks to Alex Concha for some security tips.
27
+ Thanks to Sébastien Prunier for his Spanish and French translations.
28
 
29
  ----------------------------------------------------------------------------
30
 
31
+ Versions from 0.49 onwards
32
+ Copyright 2019 Ivan Kruchkoff
33
 
34
+ Versions up to and including 0.48
35
+ Copyright 2013 Henrik Schack (email : henrik@schack.dk)
 
 
36
 
37
+ This program is free software; you can redistribute it and/or modify
38
+ it under the terms of the GNU General Public License as published by
39
+ the Free Software Foundation; either version 2 of the License, or
40
+ (at your option) any later version.
41
 
42
+ This program is distributed in the hope that it will be useful,
43
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
44
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
45
+ GNU General Public License for more details.
46
+
47
+ You should have received a copy of the GNU General Public License
48
+ along with this program; if not, write to the Free Software
49
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
50
  */
51
 
52
  class GoogleAuthenticator {
53
 
54
  static $instance; // to store a reference to the plugin, allows other plugins to remove actions
55
+ const SETUP_PAGE = 'google_authenticator_user_page';
56
+ protected $error_message = null;
57
 
58
  /**
59
  * Constructor, entry point of the plugin
67
  * Initialization, Hooks, and localization
68
  */
69
  function init() {
70
+ if ( ! class_exists( 'Base32' ) ) {
71
+ require_once( 'base32.php' );
72
+ }
73
+
74
+ if ( ! $this->is_two_screen_signin_enabled() ) {
75
+ add_action( 'login_form', array( $this, 'loginform' ) );
76
+ add_action( 'login_footer', array( $this, 'loginfooter' ) );
77
+ }
78
+
79
  add_filter( 'authenticate', array( $this, 'check_otp' ), 50, 3 );
80
 
81
  if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
87
  add_action( 'edit_user_profile', array( $this, 'edit_user_profile' ) );
88
  add_action( 'edit_user_profile_update', array( $this, 'edit_user_profile_update' ) );
89
 
90
+ add_action( 'admin_enqueue_scripts', array( $this, 'add_qrcode_script' ) );
91
+ add_action( 'admin_menu', array ( $this, 'add_pages' ) );
92
+ add_action( 'network_admin_menu', array ( $this, 'add_pages' ) );
93
+ add_action( 'current_screen', array ( $this, 'redirect_if_setup_required' ) );
94
+ add_action( 'admin_notices', array ( $this, 'successful_signup_message' ) );
95
+ add_action( 'load-admin_page_google_authenticator_user_page', array( $this, 'save_submitted_setup_page' ) );
96
 
97
  load_plugin_textdomain( 'google-authenticator', false, basename( dirname( __FILE__ ) ) . '/lang' );
98
  }
99
 
100
+ /**
101
+ * Whether we show Google Auth code on the login screen, or after the user has entered their username and password.
102
+ *
103
+ * If it's on a separate screen, it means username / passwords can still be bruteforced, but logins can't occur without 2fa
104
+ *
105
+ * @return bool
106
+ */
107
+ function is_two_screen_signin_enabled() {
108
+ $two_screen_mfa = is_multisite() ? get_site_option( 'googleauthenticator_two_screen_signin' ) : get_option( 'googleauthenticator_two_screen_signin' );
109
+ return !! $two_screen_mfa;
110
+ }
111
 
112
  /**
113
  * Check the verification code entered by the user.
114
  */
 
115
 
116
+ function verify( $secretkey, $thistry, $relaxedmode, $lasttimeslot ) {
117
  // Did the user enter 6 digits ?
118
  if ( strlen( $thistry ) != 6) {
119
  return false;
120
  } else {
121
  $thistry = intval ( $thistry );
122
  }
 
123
  // If user is running in relaxed mode, we allow more time drifting
124
+ // ±4 min, as opposed to ± 30 seconds in normal mode.
125
  if ( $relaxedmode == 'enabled' ) {
126
  $firstcount = -8;
127
+ $lastcount = 8;
128
  } else {
129
  $firstcount = -1;
130
+ $lastcount = 1;
131
  }
132
+
133
  $tm = floor( time() / 30 );
134
+
135
  $secretkey=Base32::decode($secretkey);
136
  // Keys from 30 seconds before and after are valid aswell.
137
  for ($i=$firstcount; $i<=$lastcount; $i++) {
188
  wp_enqueue_script('qrcode_script');
189
  }
190
 
191
+ /**
192
+ * Add 2fa pages to menus
193
+ */
194
+ function add_pages() {
195
+ // No menu entry for this page
196
+ add_submenu_page( null, esc_html__( 'Google Authenticator', 'google-authenticator' ), null, 'read', self::SETUP_PAGE, array( $this, 'user_setup_page' ) );
197
+
198
+ // Site admin screen
199
+ add_submenu_page( 'options-general.php', esc_html__( 'Google Authenticator', 'google-authenticator' ), esc_html__( 'Google Authenticator', 'google-authenticator' ), 'manage_options', 'google_authenticator', array( $this, 'admin_setup_page' ) );
200
+
201
+ // Network admin screen
202
+ add_submenu_page( 'settings.php', esc_html__( 'Google Authenticator', 'google-authenticator' ), esc_html__( 'Google Authenticator', 'google-authenticator' ), 'manage_network_options', 'google_authenticator', array( $this, 'network_admin_setup_page' ) );
203
+ }
204
+
205
+ /**
206
+ * Determine if a user needs to setup authy 2fa
207
+ * @return bool
208
+ */
209
+ function user_needs_to_setup_google_authenticator() {
210
+ $user = wp_get_current_user();
211
+ $enabled = trim(get_user_option( 'googleauthenticator_enabled', $user->ID ) ) === 'enabled';
212
+ if ( $enabled ) {
213
+ return false;
214
+ }
215
+
216
+ $must_signup = false;
217
+ $user_role = $user->roles[0];
218
+ $check_single_site_admin_options = true;
219
+
220
+ if ( is_multisite() ) {
221
+ $roles = get_site_option( 'googleauthenticator_mandatory_mfa_roles', array() );
222
+ if ( in_array( $user_role, $roles ) ) {
223
+ $must_signup = true;
224
+ }
225
+ $check_single_site_admin_options = '1' !== get_site_option( 'googleauthenticator_network_only' ) ;
226
+ }
227
+
228
+ if ( ! $must_signup && $check_single_site_admin_options ) {
229
+ $roles = get_option( 'googleauthenticator_mandatory_mfa_roles', array() );
230
+ if ( in_array( $user_role, $roles ) ) {
231
+ $must_signup = true;
232
+ }
233
+
234
+ }
235
+
236
+ return apply_filters( 'google_authenticator_needs_setup', $must_signup, $user );
237
+ }
238
+
239
+ /**
240
+ * Send users to the signup page if they must signup.
241
+ */
242
+ function redirect_if_setup_required() {
243
+ if ( $this->user_needs_to_setup_google_authenticator() ) {
244
+ $screen = get_current_screen();
245
+ $pagename = 'admin_page_' . self::SETUP_PAGE;
246
+ if ( is_a( $screen, 'WP_Screen') && in_array( $screen->id, array( $pagename, 'profile' ) ) ) {
247
+ return;
248
+ }
249
+
250
+ // Some check against super admin so they can enable/disable the plugin.
251
+ $location = admin_url( 'admin.php?page=' . self::SETUP_PAGE );
252
+ wp_redirect( $location);
253
+ exit;
254
+ }
255
+ }
256
+
257
+ /**
258
+ * Save the GA secret if valid totp is provided
259
+ * @return void
260
+ */
261
+ function save_submitted_setup_page() {
262
+ $this->error_message = null; // Reset a previous error message if it was set
263
+ $user = wp_get_current_user();
264
+ $secret = empty( $_POST['GA_secret'] ) ? false : sanitize_text_field( $_POST['GA_secret']);
265
+ $otp = empty( $_POST['GA_otp_code'] ) ? false : sanitize_text_field( $_POST['GA_otp_code']);
266
+ if ( ! strlen( $secret ) || ! strlen( $otp ) ) {
267
+ return;
268
+ }
269
+ $relaxed_mode = trim( get_user_option( 'googleauthenticator_relaxedmode', $user->ID ) );
270
+ $relaxed_mode = 'enabled' === $relaxed_mode ? 'enabled' : 'disabled';
271
+ if ( $timeslot = $this->verify( $secret, $otp, $relaxed_mode, '' ) ) {
272
+ update_user_option( $user->ID, 'googleauthenticator_lasttimeslot', $timeslot, true );
273
+ update_user_option( $user->ID, 'googleauthenticator_secret', $secret, true );
274
+ update_user_option( $user->ID, 'googleauthenticator_enabled', 'enabled', true );
275
+ $location = admin_url( 'index.php?googleauthenticator=enabled' );
276
+ wp_redirect( $location );
277
+ exit;
278
+ };
279
+
280
+ $this->error_message = new WP_Error( 'invalid-otp', esc_html__( "OTP code doesn't match supplied secret, please check you've configured Authenticator correctly.", 'google-authenticator' ) );
281
+ }
282
+
283
+ /**
284
+ * Show the user a success message after we redirect them following successful google authenticator setup
285
+ */
286
+ function successful_signup_message() {
287
+ if ( ! empty( $_GET['googleauthenticator'] ) && 'enabled' === $_GET['googleauthenticator'] ) : ?>
288
+ <div class="updated notice">
289
+ <p><?php esc_html_e( 'Congratulations, you have successfully enabled Google Authenticator for your account', 'google-authenticator' ); ?></p>
290
+ </div>
291
+
292
+ <?php endif;
293
+ }
294
+
295
+ /**
296
+ * Callback function to render the google authenticator setup page
297
+ */
298
+ function user_setup_page() {
299
+ $user = wp_get_current_user();
300
+ $enabled = trim(get_user_option( 'googleauthenticator_enabled', $user->ID ) ) === 'enabled';
301
+ if ( $enabled ) {
302
+ $location = admin_url( 'index.php' );
303
+ wp_redirect( $location );
304
+ exit;
305
+ }
306
+ $error = $this->error_message;
307
+
308
+ $app_links = array(
309
+ array(
310
+ 'text' => __( 'iOS: Authy', 'google-authenticator' ),
311
+ 'link' => 'https://itunes.apple.com/app/authy/id494168017',
312
+ ),
313
+ array(
314
+ 'text' => __( 'iOS: Google Authenticator', 'google-authenticator' ),
315
+ 'link' => 'https://itunes.apple.com/app/authy/id494168017',
316
+ ),
317
+ array(
318
+ 'text' => __( 'Android: Authy', 'google-authenticator' ),
319
+ 'link' => 'https://itunes.apple.com/app/authy/id494168017',
320
+ ),
321
+ array(
322
+ 'text' => __( 'Android: Google Authenticator', 'google-authenticator' ),
323
+ 'link' => 'https://itunes.apple.com/app/authy/id494168017',
324
+ ),
325
+ array(
326
+ 'text' => __( 'Windows Phone', 'google-authenticator' ),
327
+ 'link' => 'https://www.microsoft.com/store/p/authenticator/9nblggh08h54',
328
+ ),
329
+ array(
330
+ 'text' => __( 'Chrome Browser', 'google-authenticator' ),
331
+ 'link' => 'https://chrome.google.com/webstore/detail/authy-chrome-extension/fhgenkpocbhhddlgkjnfghpjanffonno',
332
+ ),
333
+ array(
334
+ 'text' => __( 'Desktop', 'google-authenticator' ),
335
+ 'link' => 'https://authy.com/download/',
336
+ ),
337
+
338
+ );
339
+
340
+ ?>
341
+ <div class="wrap">
342
+ <h1><?php esc_html_e( 'Google Authenticator Settings', 'google-authenticator' ); ?></h1>
343
+ <?php if (is_wp_error( $error ) ): ?>
344
+ <div class="error notice"><p><?php esc_html_e( $error->get_error_message() ); ?></p></div>
345
+ <?php endif; ?>
346
+ <p><?php echo esc_html__( "If you haven't already done so, please install the Authy or Google Authenticator app on your mobile device from the App Store:", 'google-authenticator' ); ?></p>
347
+ <ul>
348
+ <?php foreach( $app_links as $app_link ): ?>
349
+ <li><a href="<?php echo esc_url( $app_link[ 'link' ] ); ?>"><?php echo esc_html( $app_link[ 'text' ] ); ?></a></li>
350
+ <?php endforeach; ?>
351
+ </ul>
352
+ <p><?php echo esc_html__( 'The easiest way to enable your account is to add an account by scanning the QR code using the app.', 'google-authenticator' ); ?></p>
353
+ <p>
354
+ <?php echo esc_html__( "An account can also be added by typing in the secret. After you've added your account to the App, please type the code you see on the screen into the Authenticator Code field and press the Verify Authenticator Code button.", 'google-authenticator' ); ?>
355
+ </p>
356
+ <p>
357
+ <?php echo esc_html__( 'If the account setup was successful, you will be logged out, and will need to login again using your Username, Password and Authenticator code generated using the App on your mobile device.', 'google-authenticator' ); ?>
358
+ </p>
359
+ <form method="post">
360
+ <?php $this->profile_personal_options( array(
361
+ 'show_active' => false,
362
+ 'show_relaxed_mode' => false,
363
+ 'show_description' => false,
364
+ 'show_secret_qr' => true,
365
+ 'show_secret_buttons' => false,
366
+ 'show_authenticator_code' => true,
367
+ 'show_app_password' => false,
368
+ )); ?>
369
+ </form>
370
+ </div>
371
+ <?php
372
+ }
373
+
374
+ /**
375
+ * Save site / network wide settings
376
+ * @param $is_network
377
+ */
378
+ function save_submitted_admin_setup_page( $is_network ) {
379
+ $nonce = filter_input( INPUT_POST, 'googleauthenticator', FILTER_SANITIZE_STRING );
380
+ if ( wp_verify_nonce( $nonce, 'googleauthenticator' ) ) {
381
+ if ( $is_network ) {
382
+ $network_settings_only = array_key_exists( 'network_settings_only', $_POST );
383
+ if ( current_user_can( 'manage_network_options' ) ) {
384
+ update_site_option( 'googleauthenticator_network_only', $network_settings_only );
385
+ }
386
+ }
387
+ $two_screen_mfa = array_key_exists( 'two_screen_approach', $_POST ) && 'true' === $_POST[ 'two_screen_approach' ];
388
+ if ( is_multisite() && $is_network ) {
389
+ if ( current_user_can( 'manage_network_options' ) ) {
390
+ update_site_option( 'googleauthenticator_two_screen_signin', $two_screen_mfa );
391
+ }
392
+ } elseif ( ! $is_network ) {
393
+ if ( current_user_can( 'manage_options' ) ) {
394
+ update_option( 'googleauthenticator_two_screen_signin', $two_screen_mfa );
395
+ }
396
+ }
397
+ $roles = isset( $_POST['roles'] ) ? (array) $_POST['roles'] : array();
398
+ $roles = array_map( 'sanitize_text_field', $roles );
399
+
400
+ if ( $is_network ) {
401
+ if ( current_user_can( 'manage_network_options' ) ) {
402
+ update_site_option( 'googleauthenticator_mandatory_mfa_roles', $roles );
403
+ }
404
+ } else {
405
+ if ( current_user_can( 'manage_options' ) ) {
406
+ update_option( 'googleauthenticator_mandatory_mfa_roles', $roles );
407
+ }
408
+ }
409
+ return true;
410
+ }
411
+ }
412
+
413
+ /**
414
+ * Callback function to render the google authenticator setup page
415
+ */
416
+ function common_admin_setup_page( $is_network = false ) {
417
+ if ( $is_network ) {
418
+ $site_ids = get_sites( 'fields=ids' );
419
+ $roles = get_editable_roles();
420
+ foreach( $site_ids as $site_id ) {
421
+ switch_to_blog( $site_id );
422
+ $roles = array_merge( $roles, get_editable_roles() );
423
+ restore_current_blog();
424
+ }
425
+ $edit_enabled = true;
426
+ } else {
427
+ $roles = get_editable_roles();
428
+ $edit_enabled = is_multisite() ? boolval( get_site_option( 'googleauthenticator_network_only') ) : true;
429
+ }
430
+ $is_updated = $this->save_submitted_admin_setup_page( $is_network );
431
+ ?>
432
+ <div class="wrap">
433
+ <h1><?php esc_html_e( 'Google Authenticator Settings', 'google-authenticator' ); ?></h1>
434
+ <?php if ( $is_updated ): ?>
435
+ <?php if ( $is_network ): ?>
436
+ <div class="notice notice-success is-dismissible"><p><?php esc_html_e( 'Successfullly saved your settings for the network', 'google-authenticator' ); ?></p></div>
437
+ <?php else: ?>
438
+ <div class="notice notice-success is-dismissible"><p><?php esc_html_e( 'Successfullly saved your settings for the site', 'google-authenticator' ); ?></p></div>
439
+ <?php endif; ?>
440
+ <?php endif; ?>
441
+ <form method="post">
442
+ <?php if ( $is_network ): ?>
443
+ <h2><?php esc_html_e( 'Network Settings', 'google-authenticator' ); ?></h2>
444
+ <p>
445
+ <label>
446
+ <input name="network_settings_only" type="checkbox" value="true" <?php checked( get_site_option( 'googleauthenticator_network_only' ) ); ?>>
447
+ <?php esc_html_e( 'Only use network-wide settings, ignoring site settings.', 'google-authenticator' ); ?>
448
+ </label>
449
+ </p>
450
+ <?php endif; ?>
451
+ <?php if ( is_multisite() && $is_network || ! is_multisite() ): ?>
452
+ <?php $two_screen_mfa = is_multisite() ? get_site_option( 'googleauthenticator_two_screen_signin' ) : get_option( 'googleauthenticator_two_screen_signin' ); ?>
453
+ <h2><?php esc_html_e( 'Two Screen Signin', 'google-authenticator' ); ?></h2>
454
+ <p>
455
+ <label>
456
+ <input name="two_screen_approach" type="checkbox" value="true" <?php checked( $two_screen_mfa ); ?>>
457
+ <?php esc_html_e( 'Ask for authenticator code on secondary login screen', 'google-authenticator' ); ?>
458
+ </label>
459
+ </p>
460
+ <?php endif; ?>
461
+ <h2><?php esc_html_e( 'Roles requiring Google Authenticator Enabled', 'google-authenticator' ); ?></h2>
462
+ <?php foreach ($roles as $role_key => $role) {
463
+ $this->show_role_checkbox( $role_key, $role, $is_network );
464
+ }
465
+ if ( $edit_enabled ) {
466
+ wp_nonce_field( 'googleauthenticator', 'googleauthenticator' );
467
+ submit_button();
468
+ } else {
469
+ esc_html_e( 'Network-wide settings in effect, only a super admin can modify them.', 'google-authenticator' );
470
+ if ( current_user_can( 'manage_network' ) ) :?>
471
+ <a href="<?php echo network_admin_url( 'settings.php?page=google_authenticator' ) ?>"><?php esc_html_e( 'Change network wide Google Authenticator settings', 'google-authenticator' ); ?></a>
472
+ <?php endif;
473
+ }
474
+ ?>
475
+
476
+ </form>
477
+ </div>
478
+ <?php
479
+ }
480
+
481
+ /**
482
+ * Render a checkbox for a role
483
+ * @param $role_key
484
+ * @param $role
485
+ * @param $is_network
486
+ */
487
+ function show_role_checkbox( $role_key, $role, $is_network ) {
488
+ $network_roles = get_site_option( 'googleauthenticator_mandatory_mfa_roles', array() );
489
+ $network_only = is_multisite() && boolval( get_site_option( 'googleauthenticator_network_only' ) );
490
+ $roles = get_option( 'googleauthenticator_mandatory_mfa_roles', array() );
491
+ if ( $network_only ) {
492
+ $checked = in_array( $role_key, $network_roles );
493
+ } else {
494
+ $checked = in_array( $role_key, array_merge( $roles, $network_roles ) );
495
+ }
496
+
497
+ /**
498
+ * Criteria under which permission field can be readonly.
499
+ * 1. Site must be a multisite AND
500
+ * Either
501
+ * a. googleauthenticator_network_only network option is set via /wp-admin/network/settings.php?page=google_authenticator
502
+ *
503
+ * OR
504
+ * b. the network option for this role is set via /wp-admin/network/settings.php?page=google_authenticator
505
+ */
506
+ $readonly = is_multisite() && ( ( ! $is_network && $network_only ) || ( ! $is_network && in_array( $role_key, $network_roles ) && ! in_array( $role_key, $roles ) ) );
507
+ $readonly_label = '';
508
+
509
+ if ( $readonly ) {
510
+ if ( current_user_can( 'manage_network' ) ) {
511
+ $readonly_label = __( "Sorry, you can't disable checks for this role as it's enabled at the network level.", 'google-authenticator' );
512
+ } else {
513
+ $readonly_label = sprintf( __( 'Sorry, this role is enabled at the network level and can only be disabled via the <a href="%s">network settings</a>', 'google-authenticator' ), network_admin_url( 'settings.php?page=google_authenticator' ) );
514
+ }
515
+ }
516
+
517
+ $readonly = $readonly ? ' readonly="readonly"' : '';
518
+ ?>
519
+ <p><label><input name="roles[]" type="checkbox"<?php echo esc_html( $readonly ) . checked( $checked, true, false ); ?>value="<?php esc_attr_e( $role_key ); ?>"><strong><?php esc_html_e( $role[ 'name' ] ); ?></strong></label> <?php echo $readonly_label; ?></p>
520
+ <?php
521
+ }
522
+
523
+ /**
524
+ * Admin setup screen
525
+ */
526
+ function admin_setup_page() {
527
+ $this->common_admin_setup_page();
528
+
529
+ }
530
+
531
+ /**
532
+ * Network admin setup screen
533
+ */
534
+ function network_admin_setup_page() {
535
+ $this->common_admin_setup_page( true );
536
+ }
537
  /**
538
  * Add verification code field to login form.
539
  */
540
  function loginform() {
541
  echo "\t<p>\n";
542
  echo "\t\t<label title=\"".__('If you don\'t have Google Authenticator enabled for your WordPress account, leave this field empty.','google-authenticator')."\">".__('Google Authenticator code','google-authenticator')."<span id=\"google-auth-info\"></span><br />\n";
543
+ echo "\t\t<input type=\"text\" name=\"googleotp\" id=\"googleotp\" class=\"input\" value=\"\" size=\"20\" style=\"ime-mode: inactive;\" /></label>\n";
544
  echo "\t</p>\n";
545
  }
546
 
558
  /**
559
  * Login form handling.
560
  * Check Google Authenticator verification code, if user has been setup to do so.
561
+ * @param wordpressuser / WP_Error
562
  * @return user/loginstatus
563
  */
564
  function check_otp( $user, $username = '', $password = '' ) {
565
+ // If a failure has already occurred somewhere along the way, pass it along rather than continuing with auth.
566
+ if ( is_wp_error( $user ) ) {
567
+ return $user;
568
+ }
569
  // Store result of loginprocess, so far.
570
  $userstate = $user;
571
 
615
  return new WP_Error( 'invalid_google_authenticator_password', __( '<strong>ERROR</strong>: The Google Authenticator password is incorrect.', 'google-authenticator' ) );
616
  }
617
  } else {
618
+ if ( ! $this->is_two_screen_signin_enabled() ) {
619
+ return new WP_Error( 'invalid_google_authenticator_token', __( '<strong>ERROR</strong>: The Google Authenticator code is incorrect or has expired.', 'google-authenticator' ) );
620
+ } else {
621
+ wp_logout();
622
+ $this->secondary_login_screen();
623
+ exit;
624
+ }
625
+ }
626
  }
627
  }
628
  // Google Authenticator isn't enabled for this account,
630
  return $userstate;
631
  }
632
 
633
+ function secondary_login_screen() {
634
+ $redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : admin_url();
635
+ login_header( esc_html__('Secondary Login Screen', 'google-authenticator' ) );
636
+ if ( array_key_exists( 'googleotp', $_REQUEST ) ) {
637
+ if ( 0 === strlen( $_REQUEST[ 'googleotp'] ) ) {
638
+ $error_message = __( '<strong>ERROR</strong>: The Google Authenticator code is missing.', 'google-authenticator' );
639
+ } else {
640
+ $error_message = __( '<strong>ERROR</strong>: The Google Authenticator code is incorrect or has expired.', 'google-authenticator' );
641
+ }
642
+ echo '<div id="login_error">' . $error_message . '</div>';
643
+ }?>
644
+ <form name="loginform" id="loginform" action="<?php echo esc_url( site_url( 'wp-login.php', 'login_post' ) ); ?>" method="post">
645
+ <input type="hidden" name="log" value="<?php echo esc_attr( $_REQUEST['log'] ); ?>" />
646
+ <input type="hidden" name="pwd" value="<?php echo esc_attr( $_REQUEST['pwd'] ); ?>" />
647
+ <input type="hidden" name="wp-submit" value="<?php echo esc_attr( $_REQUEST['wp-submit'] ); ?>" />
648
+ <?php if ( array_key_exists( 'rememberme', $_REQUEST ) && 'forever' === $_REQUEST[ 'rememberme']): ?>
649
+ <input name="rememberme" type="hidden" id="rememberme" value="forever" />
650
+ <?php endif; ?>
651
+ <?php $this->loginform(); ?>
652
+ <p><?php esc_html_e( 'Please enter the Google Authenticator code using the app on your device.', 'google-authenticator' ); ?></p>
653
+ <p class="submit">
654
+ <input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e('Log In'); ?>" />
655
+ <input type="hidden" name="redirect_to" value="<?php echo esc_attr($redirect_to); ?>" />
656
+ <input type="hidden" name="testcookie" value="1" />
657
+ </p>
658
+ </form>
659
+ <?php
660
+ login_footer();
661
+ }
662
+
663
 
664
  /**
665
  * Extend personal profile page with Google Authenticator settings.
666
  */
667
+ function profile_personal_options( $args = array() ) {
668
+ $defaults = array(
669
+ 'show_active' => true,
670
+ 'show_relaxed_mode' => true,
671
+ 'show_description' => true,
672
+ 'show_secret_qr' => false,
673
+ 'show_secret_buttons' => true,
674
+ 'show_authenticator_code' => false,
675
+ 'show_app_password' => true,
676
+ );
677
+
678
+ $args = wp_parse_args( $args, $defaults );
679
+
680
+ $user = wp_get_current_user();
681
+ $user_id = $user->ID;
682
 
683
  // If editing of Google Authenticator settings has been disabled, just return
684
  $GA_hidefromuser = trim( get_user_option( 'googleauthenticator_hidefromuser', $user_id ) );
697
  $GA_password = "XXXX XXXX XXXX XXXX";
698
  }
699
 
700
+ // In case the user has no secret ready (new install), we create one. or use the one they just posted
701
  if ( '' == $GA_secret ) {
702
+ $GA_secret = array_key_exists( 'GA_secret', $_REQUEST ) ? sanitize_text_field( $_REQUEST[ 'GA_secret' ] ) : $this->create_secret();
703
  }
704
 
 
705
  if ( '' == $GA_description ) {
706
+ // Super admins and users with accounts on more than one site get the network name as the helpful name,
707
+ // everyone else gets the site that they're on
708
+ if ( is_multisite() && ( 1 < count( get_blogs_of_user( $user_id ) || is_super_admin() ) ) ) {
709
+ $GA_description = sanitize_text_field( get_blog_details( get_network()->id )->blogname );
710
+ } else {
711
+ $GA_description = sanitize_text_field( get_bloginfo( 'name' ) );
712
+ }
713
  }
714
 
715
  echo "<h3>".__( 'Google Authenticator Settings', 'google-authenticator' )."</h3>\n";
716
 
717
  echo "<table class=\"form-table\">\n";
718
  echo "<tbody>\n";
 
 
 
 
 
 
719
 
720
+ if ( $args['show_active'] ) {
721
  echo "<tr>\n";
722
+ echo "<th scope=\"row\">".__( 'Active', 'google-authenticator' )."</th>\n";
723
  echo "<td>\n";
724
+ echo "<input name=\"GA_enabled\" id=\"GA_enabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_enabled, 'enabled', false ) . "/>\n";
725
  echo "</td>\n";
726
  echo "</tr>\n";
727
+ }
 
 
 
 
728
 
729
+ if ( $args['show_relaxed_mode'] ) {
730
  echo "<tr>\n";
731
+ echo "<th scope=\"row\">" . __( 'Relaxed mode', 'google-authenticator' ) . "</th>\n";
732
  echo "<td>\n";
733
+ echo "<input name=\"GA_relaxedmode\" id=\"GA_relaxedmode\" class=\"tog\" type=\"checkbox\"" . checked( $GA_relaxedmode, 'enabled', false ) . "/><span class=\"description\">" . __( ' Relaxed mode allows for more time drifting on your phone clock (&#177;4 min).', 'google-authenticator' ) . "</span>\n";
 
 
734
  echo "</td>\n";
735
  echo "</tr>\n";
736
+ }
737
 
738
+ $show_description_style = $args['show_description'] ? '' : 'display:none';
739
+ echo "<tr style=\"{$show_description_style}\">\n";
740
+ echo "<th><label for=\"GA_description\">" . esc_html__( 'Description', 'google-authenticator' ) . "</label></th>\n";
741
+ echo "<td><input name=\"GA_description\" id=\"GA_description\" value=\"{$GA_description}\" type=\"text\" size=\"25\" /><span class=\"description\">" . __( ' Description that you\'ll see in the Google Authenticator app on your phone.', 'google-authenticator' ) . "</span><br /></td>\n";
742
+ echo "</tr>\n";
743
 
744
+ echo "<tr>\n";
745
+ echo "<th><label for=\"GA_secret\">".__('Secret','google-authenticator')."</label></th>\n";
746
+ echo "<td>\n";
747
+ echo "<input name=\"GA_secret\" id=\"GA_secret\" value=\"" . esc_attr( $GA_secret) . "\" readonly=\"readonly\" type=\"text\" size=\"25\" />";
748
+ if ( $args['show_secret_buttons']) {
749
+ echo "<input name=\"GA_newsecret\" id=\"GA_newsecret\" value=\"".__("Create new secret",'google-authenticator')."\" type=\"button\" class=\"button\" />";
750
+ echo "<input name=\"show_qr\" id=\"show_qr\" value=\"".__("Show/Hide QR code",'google-authenticator')."\" type=\"button\" class=\"button\" onclick=\"ShowOrHideQRCode();\" />";
751
+ }
752
+ echo "</td>\n";
753
+ echo "</tr>\n";
754
 
755
+ echo "<tr>\n";
756
+ echo "<th></th>\n";
757
+
758
+ $qr_style = $args['show_secret_qr'] ? '' : 'display: none';
759
+ echo "<td><div id=\"GA_QR_INFO\" style=\"{$qr_style}\" >";
760
+ echo "<div id=\"GA_QRCODE\"/></div>";
761
+
762
+ echo '<span class="description"><br/> ' . __( 'Scan this with the Google Authenticator app.', 'google-authenticator' ) . '</span>';
763
+ echo "</div></td>\n";
764
+ echo "</tr>\n";
765
+ if ( $args['show_secret_qr']) : ?>
766
+ <script>
767
+ var qrcode="otpauth://totp/WordPress:"+escape(jQuery('#GA_description').val())+"?secret="+jQuery('#GA_secret').val()+"&issuer=WordPress";
768
+ jQuery('#GA_QRCODE').qrcode(qrcode);
769
+ </script>
770
+ <?php endif;
771
+
772
+ if ( $args['show_app_password']) {
773
  echo "<tr>\n";
774
  echo "<th scope=\"row\">".__( 'Enable App password', 'google-authenticator' )."</th>\n";
775
  echo "<td>\n";
776
  echo "<input name=\"GA_pwdenabled\" id=\"GA_pwdenabled\" class=\"tog\" type=\"checkbox\"" . checked( $GA_pwdenabled, 'enabled', false ) . "/><span class=\"description\">".__(' Enabling an App password will decrease your overall login security.','google-authenticator')."</span>\n";
777
  echo "</td>\n";
778
  echo "</tr>\n";
779
+
780
  echo "<tr>\n";
781
  echo "<th></th>\n";
782
  echo "<td>\n";
787
  echo "</tr>\n";
788
  }
789
 
790
+
791
+ if ( $args['show_authenticator_code']) {
792
+ echo "<tr>\n";
793
+ echo "<th><label for=\"GA_otp_code\">" . __( 'Authenticator Code', 'google-authenticator' ) . "</label></th>\n";
794
+ echo "<td><input name=\"GA_otp_code\" id=\"GA_otp_code\" type=\"text\" size=\"25\" /><span class=\"description\">" . __( 'After adding the site to your google authy account, add your authenticator code here.', 'google-authenticator' ) . "</span><br /></td>\n";
795
+ echo "</tr>\n";
796
+ }
797
+
798
  echo "</tbody></table>\n";
799
+ if ( $args['show_authenticator_code']) {
800
+ submit_button( esc_html__( 'Verify Authenticator Code', 'google-authenticator' ) );
801
+ }
802
  echo "<script type=\"text/javascript\">\n";
803
  echo "var GAnonce='".wp_create_nonce('GoogleAuthenticatoraction')."';\n";
804
 
1005
  } // end class
1006
 
1007
  $google_authenticator = new GoogleAuthenticator;
1008
+
lang/google-authenticator.pot CHANGED
@@ -1,98 +1,244 @@
1
- # Copyright (C) 2014 Google Authenticator
2
  # This file is distributed under the same license as the Google Authenticator package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Google Authenticator 0.47\n"
6
- "Report-Msgid-Bugs-To: http://wordpress.org/tag/google-authenticator\n"
7
- "POT-Creation-Date: 2014-01-11 07:14:22+00:00\n"
 
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
- #: google-authenticator.php:166
16
- msgid "If you don't have Google Authenticator enabled for your WordPress account, leave this field empty."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  msgstr ""
18
 
19
- #: google-authenticator.php:166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  msgid "Google Authenticator code"
21
  msgstr ""
22
 
23
- #: google-authenticator.php:231
24
  msgid "<strong>ERROR</strong>: The Google Authenticator password is incorrect."
25
  msgstr ""
26
 
27
- #: google-authenticator.php:234
28
- msgid "<strong>ERROR</strong>: The Google Authenticator code is incorrect or has expired."
 
 
 
 
 
 
29
  msgstr ""
30
 
31
- #: google-authenticator.php:274
32
- msgid "WordPressBlog"
 
33
  msgstr ""
34
 
35
- #: google-authenticator.php:277 google-authenticator.php:469
36
- msgid "Google Authenticator Settings"
37
  msgstr ""
38
 
39
- #: google-authenticator.php:282 google-authenticator.php:481
40
  msgid "Active"
41
  msgstr ""
42
 
43
- #: google-authenticator.php:290
44
  msgid "Relaxed mode"
45
  msgstr ""
46
 
47
- #: google-authenticator.php:292
48
- msgid " Relaxed mode allows for more time drifting on your phone clock (&#177;4 min)."
 
 
49
  msgstr ""
50
 
51
- #: google-authenticator.php:297
52
  msgid "Description"
53
  msgstr ""
54
 
55
- #: google-authenticator.php:298
56
- msgid " Description that you'll see in the Google Authenticator app on your phone."
 
57
  msgstr ""
58
 
59
- #: google-authenticator.php:302
60
  msgid "Secret"
61
  msgstr ""
62
 
63
- #: google-authenticator.php:305
64
  msgid "Create new secret"
65
  msgstr ""
66
 
67
- #: google-authenticator.php:306
68
  msgid "Show/Hide QR code"
69
  msgstr ""
70
 
71
- #: google-authenticator.php:315
72
  msgid "Scan this with the Google Authenticator app."
73
  msgstr ""
74
 
75
- #: google-authenticator.php:320
76
  msgid "Enable App password"
77
  msgstr ""
78
 
79
- #: google-authenticator.php:322
80
  msgid " Enabling an App password will decrease your overall login security."
81
  msgstr ""
82
 
83
- #: google-authenticator.php:330
84
  msgid "Create new password"
85
  msgstr ""
86
 
87
- #: google-authenticator.php:331
88
- msgid " Password is not stored in cleartext, this is your only chance to see it."
 
 
 
 
 
89
  msgstr ""
90
 
91
- #: google-authenticator.php:474
92
- msgid "Hide settings from user"
 
 
93
  msgstr ""
94
- #. Plugin Name of the plugin/theme
95
- msgid "Google Authenticator"
 
 
 
 
 
96
  msgstr ""
97
 
98
  #. Plugin URI of the plugin/theme
@@ -100,7 +246,9 @@ msgid "http://henrik.schack.dk/google-authenticator-for-wordpress"
100
  msgstr ""
101
 
102
  #. Description of the plugin/theme
103
- msgid "Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry app as One Time Password generator."
 
 
104
  msgstr ""
105
 
106
  #. Author of the plugin/theme
1
+ # Copyright (C) 2017 Google Authenticator
2
  # This file is distributed under the same license as the Google Authenticator package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Google Authenticator 0.49\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/google-"
7
+ "authenticator\n"
8
+ "POT-Creation-Date: 2017-10-28 00:02:58+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
 
16
+ #. #-#-#-#-# google-authenticator.pot (Google Authenticator 0.49) #-#-#-#-#
17
+ #. Plugin Name of the plugin/theme
18
+ #: google-authenticator.php:190 google-authenticator.php:193
19
+ msgid "Google Authenticator"
20
+ msgstr ""
21
+
22
+ #: google-authenticator.php:268
23
+ msgid ""
24
+ "OTP code doesn't match supplied secret, please check you've configured "
25
+ "Authenticator correctly."
26
+ msgstr ""
27
+
28
+ #: google-authenticator.php:277
29
+ msgid ""
30
+ "Congratulations, you have successfully enabled Google Authenticator for your "
31
+ "account "
32
+ msgstr ""
33
+
34
+ #: google-authenticator.php:298
35
+ msgid "iOS: Authy"
36
+ msgstr ""
37
+
38
+ #: google-authenticator.php:302
39
+ msgid "iOS: Google Authenticator"
40
+ msgstr ""
41
+
42
+ #: google-authenticator.php:306
43
+ msgid "Android: Authy"
44
+ msgstr ""
45
+
46
+ #: google-authenticator.php:310
47
+ msgid "Android: Google Authenticator"
48
+ msgstr ""
49
+
50
+ #: google-authenticator.php:314
51
+ msgid "Windows Phone"
52
+ msgstr ""
53
+
54
+ #: google-authenticator.php:318
55
+ msgid "Chrome Browser"
56
+ msgstr ""
57
+
58
+ #: google-authenticator.php:322
59
+ msgid "Desktop"
60
+ msgstr ""
61
+
62
+ #: google-authenticator.php:330 google-authenticator.php:415
63
+ #: google-authenticator.php:693 google-authenticator.php:914
64
+ msgid "Google Authenticator Settings"
65
+ msgstr ""
66
+
67
+ #: google-authenticator.php:334
68
+ msgid ""
69
+ "If you haven't already done so, please install the Authy or Google "
70
+ "Authenticator app on your mobile device from the App Store:"
71
+ msgstr ""
72
+
73
+ #: google-authenticator.php:340
74
+ msgid ""
75
+ "The easiest way to enable your account is to add an account by scanning the "
76
+ "QR code using the app."
77
+ msgstr ""
78
+
79
+ #: google-authenticator.php:342
80
+ msgid ""
81
+ "An account can also be added by typing in the secret. After you've added "
82
+ "your account to the App, please type the code you see on the screen into the "
83
+ "Authenticator Code field and press the Verify Authenticator Code button."
84
+ msgstr ""
85
+
86
+ #: google-authenticator.php:345
87
+ msgid ""
88
+ "If the account setup was successful, you will be logged out, and will need "
89
+ "to login again using your Username, Password and Authenticator code "
90
+ "generated using the App on your mobile device."
91
+ msgstr ""
92
+
93
+ #: google-authenticator.php:417
94
+ msgid "foo"
95
+ msgstr ""
96
+
97
+ #: google-authenticator.php:421
98
+ msgid "Network Settings"
99
  msgstr ""
100
 
101
+ #: google-authenticator.php:425
102
+ msgid "Only use network-wide settings, ignoring site settings."
103
+ msgstr ""
104
+
105
+ #: google-authenticator.php:431
106
+ msgid "Two Screen Signin"
107
+ msgstr ""
108
+
109
+ #: google-authenticator.php:435
110
+ msgid "Ask for authenticator code on secondary login screen"
111
+ msgstr ""
112
+
113
+ #: google-authenticator.php:439
114
+ msgid "Roles requiring Google Authenticator Enabled"
115
+ msgstr ""
116
+
117
+ #: google-authenticator.php:447
118
+ msgid "Network-wide settings in effect, only a super admin can modify them."
119
+ msgstr ""
120
+
121
+ #: google-authenticator.php:449
122
+ msgid "Change network wide Google Authenticator settings"
123
+ msgstr ""
124
+
125
+ #: google-authenticator.php:489
126
+ msgid ""
127
+ "Sorry, you can't disable checks for this role as it's enabled at the network "
128
+ "level."
129
+ msgstr ""
130
+
131
+ #: google-authenticator.php:491
132
+ msgid ""
133
+ "Sorry, this role is enabled at the network level and can only be disabled "
134
+ "via the <a href=\"%s\">network settings</a>"
135
+ msgstr ""
136
+
137
+ #: google-authenticator.php:520
138
+ msgid ""
139
+ "If you don't have Google Authenticator enabled for your WordPress account, "
140
+ "leave this field empty."
141
+ msgstr ""
142
+
143
+ #: google-authenticator.php:520
144
  msgid "Google Authenticator code"
145
  msgstr ""
146
 
147
+ #: google-authenticator.php:593
148
  msgid "<strong>ERROR</strong>: The Google Authenticator password is incorrect."
149
  msgstr ""
150
 
151
+ #: google-authenticator.php:597 google-authenticator.php:618
152
+ msgid ""
153
+ "<strong>ERROR</strong>: The Google Authenticator code is incorrect or has "
154
+ "expired."
155
+ msgstr ""
156
+
157
+ #: google-authenticator.php:616
158
+ msgid "<strong>ERROR</strong>: The Google Authenticator code is missing."
159
  msgstr ""
160
 
161
+ #: google-authenticator.php:630
162
+ msgid ""
163
+ "Please enter the Google Authenticator code using the app on your device."
164
  msgstr ""
165
 
166
+ #: google-authenticator.php:632
167
+ msgid "Log In"
168
  msgstr ""
169
 
170
+ #: google-authenticator.php:700 google-authenticator.php:926
171
  msgid "Active"
172
  msgstr ""
173
 
174
+ #: google-authenticator.php:709
175
  msgid "Relaxed mode"
176
  msgstr ""
177
 
178
+ #: google-authenticator.php:711
179
+ msgid ""
180
+ " Relaxed mode allows for more time drifting on your phone clock (&#177;4 "
181
+ "min)."
182
  msgstr ""
183
 
184
+ #: google-authenticator.php:718
185
  msgid "Description"
186
  msgstr ""
187
 
188
+ #: google-authenticator.php:719
189
+ msgid ""
190
+ " Description that you'll see in the Google Authenticator app on your phone."
191
  msgstr ""
192
 
193
+ #: google-authenticator.php:723
194
  msgid "Secret"
195
  msgstr ""
196
 
197
+ #: google-authenticator.php:727
198
  msgid "Create new secret"
199
  msgstr ""
200
 
201
+ #: google-authenticator.php:728
202
  msgid "Show/Hide QR code"
203
  msgstr ""
204
 
205
+ #: google-authenticator.php:740
206
  msgid "Scan this with the Google Authenticator app."
207
  msgstr ""
208
 
209
+ #: google-authenticator.php:752
210
  msgid "Enable App password"
211
  msgstr ""
212
 
213
+ #: google-authenticator.php:754
214
  msgid " Enabling an App password will decrease your overall login security."
215
  msgstr ""
216
 
217
+ #: google-authenticator.php:762
218
  msgid "Create new password"
219
  msgstr ""
220
 
221
+ #: google-authenticator.php:763
222
+ msgid ""
223
+ " Password is not stored in cleartext, this is your only chance to see it."
224
+ msgstr ""
225
+
226
+ #: google-authenticator.php:771
227
+ msgid "Authenticator Code"
228
  msgstr ""
229
 
230
+ #: google-authenticator.php:772
231
+ msgid ""
232
+ "After adding the site to your google authy account, add your authenticator "
233
+ "code here."
234
  msgstr ""
235
+
236
+ #: google-authenticator.php:778
237
+ msgid "Verify Authenticator Code"
238
+ msgstr ""
239
+
240
+ #: google-authenticator.php:919
241
+ msgid "Hide settings from user"
242
  msgstr ""
243
 
244
  #. Plugin URI of the plugin/theme
246
  msgstr ""
247
 
248
  #. Description of the plugin/theme
249
+ msgid ""
250
+ "Two-Factor Authentication for WordPress using the Android/iPhone/Blackberry "
251
+ "app as One Time Password generator."
252
  msgstr ""
253
 
254
  #. Author of the plugin/theme
readme.txt CHANGED
@@ -1,10 +1,11 @@
1
  === Google Authenticator ===
2
- Contributors: Henrik.Schack
3
- Donate Link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=henrik%40schack%2edk&lc=US&item_name=Google%20Authenticator&item_number=Google%20Authenticator&no_shipping=0&no_note=1&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: authentication,otp,password,security,login,android,iphone,blackberry
5
  Requires at least: 4.5
6
- Tested up to: 4.7
7
- Stable tag: 0.48
 
 
8
 
9
  Google Authenticator for your WordPress blog.
10
 
@@ -55,8 +56,8 @@ just delete the wp-content/plugins/google-authenticator directory, and you'll be
55
 
56
  = I don't own a Smartphone, isn't there another way to generate these secret codes ? =
57
 
58
- Yes, there is a webbased version here : http://gauth.apps.gbraad.nl/
59
- Github project here : https://github.com/gbraad/html5-google-authenticator
60
 
61
  = Can I create backupcodes ? =
62
 
@@ -79,6 +80,17 @@ please remember to remove the "Check credentials on all login attempts" checkmar
79
  4. Google Authenticator app on Android
80
 
81
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
82
  = 0.48 =
83
  * Security fix / compatability with WordPress 4.5
84
 
@@ -151,6 +163,8 @@ please remember to remove the "Check credentials on all login attempts" checkmar
151
 
152
  Thanks to:
153
 
 
 
154
  [Tobias Bäthge](http://tobias.baethge.com/) for his code rewrite and German translation.
155
 
156
  [Pascal de Bruijn](http://blog.pcode.nl/) for his "relaxed mode" idea.
1
  === Google Authenticator ===
2
+ Contributors: ivankk
 
3
  Tags: authentication,otp,password,security,login,android,iphone,blackberry
4
  Requires at least: 4.5
5
+ Tested up to: 5.1
6
+ Stable tag: 0.50
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
10
  Google Authenticator for your WordPress blog.
11
 
56
 
57
  = I don't own a Smartphone, isn't there another way to generate these secret codes ? =
58
 
59
+ Yes, there is a webbased version here : https://gauth.apps.gbraad.nl/
60
+ Github project here : https://github.com/gbraad/gauth
61
 
62
  = Can I create backupcodes ? =
63
 
80
  4. Google Authenticator app on Android
81
 
82
  == Changelog ==
83
+ = 0.50 =
84
+ * New maintainer ivankk
85
+ * Conditionally include base32 class
86
+
87
+ = 0.49 =
88
+ * More streamlined sign-up flow for users, configuration screen for admins.
89
+ * Multisite support to either enable 2fa by role on a site, and/or on a network.
90
+ * Added filter google_authenticator_needs_setup to determine if user needs to enable 2fa.
91
+ * Added two part login process that can ask for 2fa code on a second login screen.
92
+ * Fixed a security bug that continued check_otp even if authenticate had already returned an error.
93
+
94
  = 0.48 =
95
  * Security fix / compatability with WordPress 4.5
96
 
163
 
164
  Thanks to:
165
 
166
+ [Henrik.Schack](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=henrik%40schack%2edk&lc=US&item_name=Google%20Authenticator&item_number=Google%20Authenticator&no_shipping=0&no_note=1&tax=0&bn=PP%2dDonationsBF&charset=UTF%2d8) for writing/maintaining versions 0.20 through 0.48
167
+
168
  [Tobias Bäthge](http://tobias.baethge.com/) for his code rewrite and German translation.
169
 
170
  [Pascal de Bruijn](http://blog.pcode.nl/) for his "relaxed mode" idea.