Commit graph

102 commits

Author SHA1 Message Date
Reedy 035e073ddb Don't use logging reserved word 'ip' as parameter
Bug: T245280
Change-Id: I368724e9e6de85df45fd8734668789e8d524214f
Follows-up: I5f602bc08902b63acbb0752093b418d0ab063493
2020-02-27 15:11:16 +00:00
Brian Wolff bb0a85ea5e log login captchas to "captcha" channel instead of "authevents"
Also makes the log events more useful by including the username
in question and fix logging logins as being account creations.
See also Icde984d27.

Bug: T210817
Change-Id: I5f602bc08902b63acbb0752093b418d0ab063493
2020-02-11 09:04:55 -08:00
jenkins-bot f5f9c0971d Merge "Remove unused return values and reduce code complexity" 2020-02-09 17:27:11 +00:00
Ammar Abdulhamid 07a2824630 Replace deprecated IP class with IP Utilities
* Also bump required MW version to 1.35.0

Bug: T242556
Change-Id: I279e7d83a0dc75414117208ed23f8cc6b729eb19
2020-02-09 08:23:02 +01:00
Thiemo Kreuz 0dfd1f4ed1 Remove unused return values and reduce code complexity
Changes:
* Do not return anything in a method that is not expected to return
  something.
* Inline some previously hard to read code.
* More specific type hints, if possible.

Change-Id: I0e460899eea07d8733f638a11133adc3000f0542
2020-02-03 15:37:32 +01:00
jenkins-bot efadd21e76 Merge "Stop passing objects by reference" 2020-01-19 16:43:11 +00:00
Max Semenik 9380fa050e Stop passing objects by reference
Bug: T193950
Change-Id: I8c4aabe75ffce55f81c7ffb0f76b67155db1f761
2020-01-17 20:08:16 +00:00
libraryupgrader 54f6c6d87e build: Updating mediawiki/mediawiki-codesniffer to 29.0.0
Additional changes:
* Also sorted "composer fix" command to run phpcbf last.

Change-Id: Iba0ed9df5be4a7fbedce377556c87d42bddfb509
2020-01-14 04:33:04 +00:00
libraryupgrader d481d0c8db build: Updating mediawiki/mediawiki-phan-config to 0.9.0
Additional changes:
* Added .eslintcache to .gitignore.
* Fix wrong types

Change-Id: I833b061c62b82f3c88d968c70bae8317641aaa3d
2019-12-27 14:42:40 +00:00
Daimona Eaytoy 7297235b2a Pass correct type to constructor
Although there was no docblock on CaptchaAuthenticationRequest::__construct,
the method is supposed to get a string and an array, as that's how the
class members are documented and used. Trying to access offsets of null
resulted in PHP notices on PHP 7.4, as seen in the experimental job
for various repos.

Bug: T239726
Change-Id: Idd073ebf3d560543ec225479de060e3c198847eb
2019-12-03 19:30:55 +00:00
Daimona Eaytoy 2971bace15 Remove redundant reference from EditPage hook handler
Bug: T234118
Change-Id: I0f6305bf881c7ffb4383568730f24f89388ae897
2019-09-28 13:05:39 +00:00
Derick Alangi 92b41aa481 Avoid usage of deprecated ObjectCache::getMainWANInstance()
Replacement with services made available in 1.28 and this extension
requires 1.31. So, the replacement is good.

Change-Id: Idd5dda1e7cfa34b71ffb13446eb0f9e4f113f678
2019-07-03 13:43:23 +01:00
Florian fe6d078b9f [recaptcha] Remove the ReCaptcha module
It's not supported by Google for a while.

Bug: T223749
Change-Id: I159cdd4882c1de48d6cee359faa153a2e6e0424b
2019-06-22 10:38:39 +01:00
Umherirrender 7f76ef9924 Add phan
Change-Id: If382ed4440aa96dcb32a8aba6726cc7e78f0e0a7
2019-05-28 21:05:39 +02:00
Umherirrender ca72ab9a21 Document CaptchaStore to store arrays
SimpleCaptcha::storeCaptcha is passing an array to CaptchaStore::store,
so allow to store arrays
The implemenation allows to store mixed

Change-Id: I24bb8d852475c054c179a8c8d48417d8983797fa
2019-05-26 22:19:03 +02:00
Derick Alangi 7e97119a91 store: Avoid deprecated use of ObjectCache::getMainStashInstance()
And also, avoid deprecated use of wfMemcKey() global function. So,
create a BagOStuff cache object and use. ::getMainStashInstance() was
deprecated in 1.28 and the MainObjectStash service was marked available.

Currently, extension requires MediaWiki 1.31 at the minimum so the
replacement is safe.

Change-Id: I01494a2dcbcbf30fe9960fdfb55b4912a648c7b6
2019-05-08 22:59:16 +01:00
libraryupgrader 223ff14572 build: Updating mediawiki/phan-taint-check-plugin to 1.3.0
And updating CoC link to use Special:MyLanguage (T202047).

Change-Id: I9830f95de17383a7f4fba6f323550bc9061acc06
2018-08-19 12:06:19 -07:00
Max Semenik 5b7a36a521 Clean up some phpcs problems
Change-Id: Ie956fe86184535a376d0398483ac3c853fa9127c
2018-07-12 23:13:58 +00:00
C. Scott Ananian bcc9f5a9e2 Replace uses of deprecated Language::truncate()
See I2291c69d9df17c1a9e4ab1b7d4cbc73bc51d3ebb for the anticipated
hard-deprecation of this method in core.

Bug: T197492
Change-Id: I08b5c7b0c8cc1b88f07163cfd412e5d7e87c56f3
2018-06-16 09:24:51 -04:00
Umherirrender 8a3c51b1db Move classes to own files
Makes MediaWiki.Files.OneClassPerFile.MultipleFound pass

Change-Id: I88b5112d84d8983e67be1bca9f4039486bcefc6f
2017-12-16 13:32:46 +01:00
jenkins-bot 7aae3b655b Merge "Allow other extensions to setup triggers using attributes" 2017-10-24 17:49:56 +00:00
Umherirrender 1254022153 Improve some parameter docs
Change-Id: Idce2db0b489c19ec9b936cfc4ced3792e6f9711d
2017-09-24 12:14:11 +00:00
libraryupgrader 8b439b582d build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I155f72352224f230e94950f149fba400f26cbe6c
2017-09-24 10:04:06 +00:00
Florian Schmidt 50bc57a200 Allow other extensions to setup triggers using attributes
Instead of misusing the config section of extension.json to declare
captcha triggers in the ConfirmEdits CaptchaTriggers config variable,
other extensions can now use the CaptchaTriggers attribute for the
exact same thing. E.g., to declare a new trigger, the following
addition to the own extension.json will register the trigger in
ConfirmEdit:

  "CaptchaTriggers": {
    "wikiforum": true
  }

This also removes the CaptchaClass config from the main extension.json
config section, and automatically sets the SimpleCaptcha module in the
getInstance() method of ConfirmEditHooks, which is a pre-requirement for
the mediawiki/core change Ieeb26011e42c741041d2c3252238ca0823b99eb4.

Bug: T152929
Change-Id: I4c5eaf87657f5dc07787480a2f1a56a1db8c714f
2017-09-02 17:45:26 +02:00
libraryupgrader 61e4e142eb build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
The following sniffs are failing and were disabled:
* MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic
* MediaWiki.Commenting.FunctionComment.MissingParamComment
* MediaWiki.Commenting.FunctionComment.MissingParamName
* MediaWiki.Commenting.FunctionComment.MissingParamTag
* MediaWiki.Commenting.FunctionComment.MissingReturn
* MediaWiki.Commenting.FunctionComment.MissingReturnType
* MediaWiki.Commenting.FunctionComment.ParamNameNoMatch
* MediaWiki.Commenting.FunctionComment.WrongStyle
* MediaWiki.Files.ClassMatchesFilename.NotMatch
* MediaWiki.Files.OneClassPerFile.MultipleFound

The following sniffs now pass and were enabled:
* MediaWiki.Commenting.FunctionComment

Change-Id: Id3af93f7485712b063b758cbd40752c1bfcb0b2e
2017-09-01 04:47:36 +00:00
Kunal Mehta cb2a80dab7 build: Update mediawiki/mediawiki-codesniffer to 0.11.1
Change-Id: Ie1307df0f85cf0ccb7ad24961df7b63005f9c745
2017-08-16 01:37:58 -07:00
Umherirrender 1d60bc25d2 build: Updating mediawiki/mediawiki-codesniffer to 0.10.0
Change-Id: I8d107ad6801fe1a5ce7b8feb8e1e730d504a2fb3
2017-07-08 16:04:35 +02:00
Timo Tijhof a480d98b3f Fixup use of $ceAllowConfirmedEmail
Follows-up 37f2dcf. confirmEditSetup() maps it to the new name so any use of it within
the extension can safely be replaced.

* Fix Catpcha.php.
* Update README.md.

Change-Id: I4b23954eba2d7d3e86e4f60d8189e263b864fbd3
2017-04-28 18:58:44 -07:00
Florian Schmidt 37f2dcfd23 Rename $ceAllowConfirmedEmail to $wgAllowConfirmedEmail
The value of $ceAllowConfirmedEmail is copied to $wgAllowConfirmedEmail if
set in LocalSettings.php for backward-compatibility. However, a deprecation
warning is emitted in this case.

Bug: T162641
Change-Id: If4daf6f25f0d2b2c0f1e173ee3903063a39978bb
2017-04-17 19:26:37 +02:00
Reedy 55949565bb Remove pre-AuthManager support
Bump version to match

Fixup some whitespace. Fixup some function level documentation

Change-Id: I72fa5e3f68c0c3de3f3ddae2fb16ba5fad6a67b2
2017-02-17 13:26:46 +00:00
Gergő Tisza bbc318fb51 Rename 'type' field of authevents channel to 'eventType'
'type' is problematic as it conflicts with a default field name
in logstash.

Bug: T145133
Change-Id: Idb73ba3e431ef2bd25b14c8562d1b3f212b4e072
Depends-On: Iab1eb47a6b6c98f3c84b4f8e2d16cbe2cdbf515b
2016-11-26 01:12:58 +00:00
Brad Jorsch ac97e69999 Remove pre-1.25 API compatibility code
Since this extension uses extension.json, it already requires 1.25+ so
no need to keep the old code around.

Change-Id: I31b96b0939d5321be31889422cfc703c9c6c2baa
2016-09-20 15:32:05 -04:00
Florian 1163b6f100 Replace the edit preview with a validation of whitelisted IP addresses
The user now can press the preview button to bring up an interpreted list
of the lines of the interface message MediaWiki:Captcha-ip-whitelist to check
if the added/remained data is (still) a valid list of (whitelisted) IP addresses.

Bug: T129757
Change-Id: Ic61f00e7f88c9290ae6e11f7258c11a730ac98c8
2016-08-21 18:54:41 +02:00
Florian Schmidt fc71c869e1 Use TitleReadWhitelist for automatic whitelist
Instead of abusing the extension.json callback.

Bug: T142259
Change-Id: I12501ebfa61a4b2f72cec1f94b86a54e56c28719
2016-08-18 20:08:51 +02:00
jenkins-bot b3924fe2ba Merge "Rename 'authmanager' log channel to 'authevents'" 2016-08-10 17:18:17 +00:00
Gergő Tisza 842dd1ae1f Rename 'authmanager' log channel to 'authevents'
Change-Id: I86f54474714fee19e18dabe7c523ebe1901e51a5
2016-08-10 01:39:29 +00:00
Reedy 6a8c53f6d1 Remove 'UnitTestList' hook
No longer needed now that extension unittests are autodiscovered.

Bug: T142120
Bug: T142121
Change-Id: I7105170e56c8c3ec3837dd15be869e503bccecde
2016-08-05 18:46:15 +01:00
addshore eedab34d3d Unset CaptchaStore instance before test
Caught while tests were running for core.

Fatal error:
Call to undefined method CaptchaSessionStore::clearAll() in
ConfirmEdit/tests/CaptchaAuthenticationRequestTest.php
on line 13

Change-Id: I3a9f5b315eb114cb12ea4071f8da9079f797fcf6
2016-07-28 14:59:58 +01:00
Bartosz Dziewoński 5c9e5cfccd Remove backwards-compatibility code using APIEditBeforeSave hook
It was only needed for MediaWiki prior to 1.25
(09a5febb7b024c0b6585141bb05cba13a642f3eb).
We no longer support those versions after
1d08dd07b8.

Bug: T137832
Change-Id: I27f244631e9dcd160bffff70349e5034f2a537ea
2016-06-16 17:54:54 +02:00
Kunal Mehta 0ebe3f7a28 Fix file permissions
Change-Id: If4855e3a6d7d35dd94093108f4da3bd1362f6827
2016-06-09 16:19:58 -07:00
Gergő Tisza 3e3b91b527 Add AuthManager support for ReCaptcha, ReCaptchaNoCaptcha
Also remove references to "two words" from ReCaptcha labels.
The captcha image doesn't always contain two words.

Bug: T110302
Change-Id: I544656289480056152a1db195babb6dadf29bc71
2016-05-16 09:51:11 +00:00
Gergő Tisza 31c59374a4 Add AuthManager support to SimpleCaptcha, QuestyCaptcha, FancyCaptcha, MathCaptcha
Also update MathCaptcha so that it works with recent versions of
Math (and breaks with old ones). Also fix MathCaptcha API output,
which used to send the question in plaintext.

Bug: T110302
Change-Id: I0da671a546700110d789b79a3089460abd9cce3b
Depends-On: I8b52ec8ddf494f23941807638f149f15b5e46b0c
2016-05-16 09:50:25 +00:00
Kunal Mehta 9ea898ba2a build: Updating mediawiki/mediawiki-codesniffer to 0.7.1
Also added "composer fix" command.

Change-Id: Ibda3fd002c577c7f7c41920d67ec44fedbd27cb8
2016-05-09 16:41:17 -07:00
Glaisher d0adbc8f0f Allow IP whitelist to be modified on wiki
Local administrators can now use [[MediaWiki:Captcha-ip-whitelist]]
page to exempt specific IP addresses and IP ranges from captchas.
This is useful for modifying in a short notice such as editathons and
other events like this where captchas add unnecessary complexity for
new users.

The page is disabled by default and IPs should be added separated by
newlines. If any other character is found on a line, it will be ignored
but leading and trailing whitespace characters are allowed.

Bug: T103122
Change-Id: I54866b5bfca80debcf3d3fb7963932ed03b48548
2016-03-12 14:17:23 +05:00
Paladox 30490fba52 Add php code sniffer
Change-Id: I298b8b936a2b86deea75c302d88a7391cdb221c9
2015-10-28 21:46:29 +00:00
jenkins-bot 39636476ae Merge "Conversion to using getMainStashInstance()" 2015-07-15 08:31:34 +00:00
Aaron Schulz 63d0bc66e0 Conversion to using getMainStashInstance()
Bug: T97620
Change-Id: I94be31eb95cd86c2b922d1c802c6e6c6785b7905
2015-06-30 18:05:33 +00:00
Brad Jorsch e5cb34c058 Fix issues from recent extension registration changes
* Move ApiFancyCaptchaReload.php into the FancyCaptcha subdir
* Fix include of recaptchalib.php
* Restore efReCaptcha() that was randomly deleted

Bug: T100775
Bug: T100504
Bug: T100505
Change-Id: I70f9c3f1610fed5aa4b88f3512b86e1a40d64a6b
2015-05-29 14:35:55 +00:00
Florian d7e46583ed Clear PHP entry point and use extension.json for ReCaptcha
Bug: T88047
Change-Id: Id09113674c2a4c4cfd7539b3e752bfca776a5903
2015-05-23 11:32:16 +02:00
Florian bf412aad28 Add extension.json and clear PHP entry point
Bug: T88047
Change-Id: I6930b478ea094ab9ce829f167674995de6c16bdf
2015-05-23 11:12:26 +02:00
Florian 4d56806849 Fix Hook function should be static
Follow up: Ifcac2ad0d7

Change-Id: I39257712623beb48270fe01e5a41f510586d5dc0
2015-05-21 18:08:41 +02:00
Florian 806c8862df Clean up ConfirmEdit.php entry point and move common files to common places
2. step to use ExtensionRegistration

Bug: T88047
Change-Id: Ifcac2ad0d792a05c391ca1776824e05ab703d5cf
2015-05-21 17:49:13 +02:00