Go to file
Timo Tijhof 6b106fe10c TOTPKey: Use foreach instead of for-i-length and remove dead code
Follows-up c943f75.

* Use foreach to iterate the list of tokens, instead of i-to-length.

* Remove the redundant 'retval = false' assignment, as this was
  within an `if (!$retval)` block where the only previous assignment
  to it was either retval = 1 or retval = false. Hence redundant.

* Remove the conditional that made the list only checked if the
  list was not identical to `[ 0 => "" ]`.
  It is unclear to me why this check existed.
  I can imagine one of two scenarios, neither of which appears
  to be the case:
  1. Maybe the scratch list contains 10 tokens plus an empty string,
     and if we see it only contains that, we know it's logically empty
     and don't "need" to iterate the list.
     Except... iterating the list is cheap, so why bother?

  2. Maybe the scratch list contains 10 tokens plus an empty string,
     and we don't want to allow the empty string to be considered
     a valid scratch token to we skip the loop if that's the only
     one left.

     Except... if that were the case we'd be in trouble as it
     isn't being disallowed when the list contains other items
     still. And again, afaik it never contains an empty string,
     and hopefully empty input is already rejected by now.

   Neither of these are good reasons to remove the code without
   knowing what it was for though, so I'd rather we figure this
   out before merging. I can restore the check if it's non-trivial
   to find out.

Bug: T256918
Change-Id: Ide4160bdc18bc47da9632791fb4321e44d6d115a
2021-03-29 21:42:56 +00:00
.phan Upgrade to newer phan 2019-03-17 11:38:10 -07:00
i18n Localisation updates from https://translatewiki.net. 2021-03-29 08:36:41 +02:00
maintenance Update TOTP Scratch Tokens to array 2020-12-31 01:18:05 +00:00
modules/totp build: Updating npm dependencies 2020-01-08 17:35:22 +00:00
sql Make SQLite compatible patches 2020-10-04 20:40:27 +00:00
src TOTPKey: Use foreach instead of for-i-length and remove dead code 2021-03-29 21:42:56 +00:00
tests/phpunit/Auth Refactor includes to src #2 2019-07-04 13:36:13 +00:00
.eslintignore build: Remove duplicate eslintignore info from Gruntfile.js 2019-07-15 22:08:27 -04:00
.eslintrc.json build: Updating eslint-config-wikimedia to 0.19.0 2021-03-14 04:29:18 +00:00
.gitignore build: Upgrade eslint-config-wikimedia 0.12.0, drop grunt-jsonlint 2019-05-07 09:59:52 -07:00
.gitreview Whoops, track not trace 2016-10-24 17:03:06 -07:00
.phpcs.xml Avoid wfMessage in special page 2020-12-19 12:16:51 +01:00
.stylelintrc.json Use json extension for .stylelintrc 2017-08-19 10:12:13 +02:00
CODE_OF_CONDUCT.md build: Updating mediawiki/phan-taint-check-plugin to 1.3.0 2018-08-19 14:49:59 +00:00
composer.json build: Updating dependencies 2021-01-30 06:33:24 +00:00
COPYING Add COPYING 2014-01-22 21:34:11 +00:00
extension.json build: Updating dependencies 2021-01-30 06:33:24 +00:00
Gruntfile.js build: Updating dependencies 2021-01-30 06:33:24 +00:00
OATHAuth.alias.php Czech translation of new special pages 2020-11-25 23:48:08 +01:00
package-lock.json build: Updating eslint-config-wikimedia to 0.19.0 2021-03-14 04:29:18 +00:00
package.json build: Updating eslint-config-wikimedia to 0.19.0 2021-03-14 04:29:18 +00:00
ServiceWiring.php build: Updating mediawiki/mediawiki-codesniffer to 29.0.0 2020-01-14 08:27:31 +00:00