Add password policy setting `suggestChangeOnLogin`
authorDayllan Maza <dmaza@wikimedia.org>
Wed, 20 Feb 2019 06:02:33 +0000 (01:02 -0500)
committerDayllan Maza <dmaza@wikimedia.org>
Sat, 9 Mar 2019 19:59:02 +0000 (14:59 -0500)
commit4b39919c473e165071cf32198e534e4ef1e3576c
treec9ec4227d0181e7622c43c4679c338265a809115
parentca3ff245607d147c3d6e3408966ceaeb7e260bbf
Add password policy setting `suggestChangeOnLogin`

Password policy checks that fail and have `suggestChangeOnLogin` set to true will
prompt for a password change on login.

Below are some rules that apply to this setting in different scenarios:

- If only one policy fails and has `suggestChangeOnLogin = false`, a password change will
  not be requested
- If more than one policy fails and one or more have `suggestChangeOnLogin` set to true`,
  a password change will be requested
- If `forceChange` is present in any of the failing policies, `suggestChangeOnLogin` value
  will be ignored and password change will be enforced
- if $wgInvalidPasswordReset is set to false `suggestChangeOnLogin` is ignored

IMPORTANT**
Before this patch, suggesting a password change was the default behavior (depending on
$wgInvalidPasswordReset), which means that the necessary changes to $wgPasswordPolicy
need to be in place before this patch is merged and gets to production.

Bug: T211621
Change-Id: I7a4a0a06273fa4e8bd0da3dac54cf5a1b78bb3fd
includes/DefaultSettings.php
includes/auth/AbstractPasswordPrimaryAuthenticationProvider.php
includes/auth/LocalPasswordPrimaryAuthenticationProvider.php
includes/password/UserPasswordPolicy.php
includes/user/User.php
languages/i18n/en.json
languages/i18n/qqq.json
tests/phpunit/includes/auth/AbstractPasswordPrimaryAuthenticationProviderTest.php
tests/phpunit/includes/auth/LocalPasswordPrimaryAuthenticationProviderTest.php
tests/phpunit/includes/password/UserPasswordPolicyTest.php
tests/phpunit/structure/PasswordPolicyStructureTest.php