Skip to content

Commit 2c50344

Browse files
authored
4.2.3 Release
2 parents dee9f89 + 77dfd35 commit 2c50344

File tree

23 files changed

+267
-24
lines changed

23 files changed

+267
-24
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ before_install:
3535
- nvm install 10.12.0
3636
# Install Redis and Memcached
3737
- echo "extension = memcached.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini
38-
- printf "\n" | pecl install -f redis
38+
# Temporary disabled as it's not compatible with PHP 5.6
39+
# - printf "\n" | pecl install -f redis
3940

4041
before_script:
4142
# install deps and UF

CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## [v4.2.3]
9+
10+
### Added
11+
- Config to set Domain of RememberMe Cookie ([#990], [#991]; Thanks @xrobau !)
12+
- Config settings for password min/max length ([#993])
13+
- `migrate:clean` bakery command ([#1007])
14+
15+
### Fixed
16+
- [PHPMailer] Turn off opportunistic TLS when disabled ([#986], [#987])
17+
- Migrator now ignore files that don't end in `.php` ([#965], [#998])
18+
- Respects CSRF_ENABLED environment variable ([#976]; Thanks @Poldovico !)
19+
- Checkbox bug on password change form ([#1008])
20+
- On role page, users table action buttons not working ([#1010])
21+
822
## [v4.2.2]
923

1024
### Added
@@ -755,10 +769,22 @@ See [http://learn.userfrosting.com/upgrading/40-to-41](Upgrading 4.0.x to 4.1.x
755769
[#953]: https://github.com/userfrosting/UserFrosting/issues/953
756770
[#958]: https://github.com/userfrosting/UserFrosting/issues/958
757771
[#963]: https://github.com/userfrosting/UserFrosting/issues/963
772+
[#965]: https://github.com/userfrosting/UserFrosting/issues/965
758773
[#968]: https://github.com/userfrosting/UserFrosting/issues/968
774+
[#976]: https://github.com/userfrosting/UserFrosting/issues/976
759775
[#981]: https://github.com/userfrosting/UserFrosting/issues/981
760776
[#983]: https://github.com/userfrosting/UserFrosting/issues/983
777+
[#986]: https://github.com/userfrosting/UserFrosting/issues/986
778+
[#987]: https://github.com/userfrosting/UserFrosting/issues/987
779+
[#990]: https://github.com/userfrosting/UserFrosting/issues/990
780+
[#991]: https://github.com/userfrosting/UserFrosting/issues/991
781+
[#993]: https://github.com/userfrosting/UserFrosting/issues/993
782+
[#998]: https://github.com/userfrosting/UserFrosting/issues/998
783+
[#1007]: https://github.com/userfrosting/UserFrosting/issues/1007
784+
[#1008]: https://github.com/userfrosting/UserFrosting/issues/1008
785+
[#1010]: https://github.com/userfrosting/UserFrosting/issues/1010
761786

762787
[v4.2.0]: https://github.com/userfrosting/UserFrosting/compare/v4.1.22...v4.2.0
763788
[v4.2.1]: https://github.com/userfrosting/UserFrosting/compare/v4.2.0...v.4.2.1
764789
[v4.2.2]: https://github.com/userfrosting/UserFrosting/compare/v.4.2.1...v4.2.2
790+
[v4.2.3]: https://github.com/userfrosting/UserFrosting/compare/v4.2.2...v4.2.3

app/defines.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
namespace UserFrosting;
1212

1313
// Some standard defines
14-
define('UserFrosting\VERSION', '4.2.2');
14+
define('UserFrosting\VERSION', '4.2.3');
1515
define('UserFrosting\DS', '/');
1616
define('UserFrosting\PHP_MIN_VERSION', '5.6');
1717
define('UserFrosting\PHP_RECOMMENDED_VERSION', '7.2');

app/sprinkles/account/config/default.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,37 @@
5555
* RememberMe Package Settings
5656
* ----------------------------------------------------------------------
5757
* See https://github.com/gbirke/rememberme for an explanation of these settings
58+
*
59+
* Note that the 'domain' field can be set to match your top-level-domain if you
60+
* want to send the rememberme to all hosts in your domain. An automatic config
61+
* of this can be done in your config.php with code similar to this:
62+
*
63+
* if (!empty($_SERVER['SERVER_NAME']) && filter_var($_SERVER['SERVER_NAME'], \FILTER_VALIDATE_IP) === false) {
64+
* $darr = explode(".", $_SERVER['SERVER_NAME']);
65+
* array_shift($darr);
66+
* $conf['session']['cookie_parameters'] = [ "lifetime" => 86400, "domain" => ".".join(".", $darr), "path" => "/" ];
67+
* $conf['remember_me'] = [ "domain" => ".".join(".", $darr) ];
68+
* }
69+
*
70+
* (Or, for production, you can hard-code the domain rather than calculating it on each page load)
71+
*
72+
* This is DELIBERATELY NOT TURNED ON BY DEFAULT!
73+
*
74+
* If you enable the 'domain' (on both the session and the remember_me cookies)
75+
* you will be sending your authentication cookies to every machine in the
76+
* domain you are using. This may not be bad if you control the domain, but
77+
* if you are using a VPS and the hostname of the machine you are connecting to
78+
* is, for example, host2.vps.blah.com, and you connect to host20.vps.blah.com,
79+
* your browser will send your (super secret) cookies to host20.vps.blah.com.
80+
*
81+
* You only want to turn this on if you want machine1.foo.com to receive the
82+
* cookies that THIS MACHINE (machine2.foo.com) set.
5883
*/
5984
'remember_me' => [
6085
'cookie' => [
6186
'name' => 'rememberme',
6287
],
88+
'domain' => null,
6389
'expire_time' => 604800,
6490
'session' => [
6591
'path' => '/',
@@ -96,7 +122,8 @@
96122
* Account Site Settings
97123
* ----------------------------------------------------------------------
98124
* "Site" settings that are automatically passed to Twig. Use theses
99-
* settings to control the login and registration process
125+
* settings to control the login, password (re)set and registration
126+
* processes
100127
*/
101128
'site' => [
102129
'login' => [
@@ -115,6 +142,12 @@
115142
],
116143
],
117144
],
145+
'password' => [
146+
'length' => [
147+
'min' => 8,
148+
'max' => 25,
149+
],
150+
],
118151
],
119152

120153
/*

app/sprinkles/account/locale/es_ES/messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
'PASSWORD' => [
100100
'@TRANSLATION' => 'Contraseña',
101101

102-
'BETWEEN' => 'Entre {{min}} - {{max}} (recomendado 12)',
102+
'BETWEEN' => 'Entre {{min}} - {{max}}',
103103

104104
'CONFIRM' => 'Confirmar contraseña',
105105
'CONFIRM_CURRENT' => 'Por favor, confirma tu contraseña actual',

app/sprinkles/account/src/Authenticate/Authenticator.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,15 @@ public function __construct(ClassMapper $classMapper, Session $session, Config $
118118
$this->rememberMe->getCookie()->setPath($this->config['remember_me.session.path']);
119119

120120
// Set expire time, if specified
121-
if ($this->config->has('remember_me.expire_time') && ($this->config->has('remember_me.expire_time') != null)) {
121+
if ($this->config->has('remember_me.expire_time') && $this->config->has('remember_me.expire_time') != null) {
122122
$this->rememberMe->getCookie()->setExpireTime($this->config['remember_me.expire_time']);
123123
}
124124

125+
// Set domain, if specified
126+
if ($this->config->has('remember_me.domain') && $this->config->has('remember_me.domain') != null) {
127+
$this->rememberMe->getCookie()->setDomain($this->config['remember_me.domain']);
128+
}
129+
125130
$this->user = null;
126131
$this->viaRemember = false;
127132
}

app/sprinkles/account/src/Bakery/CreateAdminUser.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,11 @@ protected function validateLastName($lastName)
298298
*/
299299
protected function askPassword($password = '', $requireConfirmation = true)
300300
{
301+
$passwordMin = $this->ci->config['site.password.length.min'];
302+
$passwordMax = $this->ci->config['site.password.length.max'];
303+
301304
while (!isset($password) || !$this->validatePassword($password) || !$this->confirmPassword($password, $requireConfirmation)) {
302-
$password = $this->io->askHidden('Enter password (12-255 characters)');
305+
$password = $this->io->askHidden('Enter password (' . $passwordMin . '-' . $passwordMax . ' characters)');
303306
}
304307

305308
return $password;
@@ -314,9 +317,11 @@ protected function askPassword($password = '', $requireConfirmation = true)
314317
*/
315318
protected function validatePassword($password)
316319
{
317-
//TODO Config for this ??
318-
if (strlen($password) < 12 || strlen($password) > 255) {
319-
$this->io->error('Password must be between 12-255 characters');
320+
$passwordMin = $this->ci->config['site.password.length.min'];
321+
$passwordMax = $this->ci->config['site.password.length.max'];
322+
323+
if (strlen($password) < $passwordMin || strlen($password) > $passwordMax) {
324+
$this->io->error('Password must be between ' . $passwordMin . ' and ' . $passwordMax . ' characters');
320325

321326
return false;
322327
}

app/sprinkles/account/src/Controller/AccountController.php

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,10 @@ public function pageRegister(Request $request, Response $response, $args)
519519

520520
// Load validation rules
521521
$schema = new RequestSchema('schema://requests/register.yaml');
522+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
523+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
524+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
525+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
522526
$validatorRegister = new JqueryValidationAdapter($schema, $this->ci->translator);
523527

524528
// Get locale information
@@ -593,11 +597,18 @@ public function pageResendVerification(Request $request, Response $response, $ar
593597
*/
594598
public function pageResetPassword(Request $request, Response $response, $args)
595599
{
600+
/** @var \UserFrosting\Support\Repository\Repository $config */
601+
$config = $this->ci->config;
602+
596603
// Insert the user's secret token from the link into the password reset form
597604
$params = $request->getQueryParams();
598605

599606
// Load validation rules - note this uses the same schema as "set password"
600607
$schema = new RequestSchema('schema://requests/set-password.yaml');
608+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
609+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
610+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
611+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
601612
$validator = new JqueryValidationAdapter($schema, $this->ci->translator);
602613

603614
return $this->ci->view->render($response, 'pages/reset-password.html.twig', [
@@ -627,11 +638,18 @@ public function pageResetPassword(Request $request, Response $response, $args)
627638
*/
628639
public function pageSetPassword(Request $request, Response $response, $args)
629640
{
641+
/** @var \UserFrosting\Support\Repository\Repository $config */
642+
$config = $this->ci->config;
643+
630644
// Insert the user's secret token from the link into the password set form
631645
$params = $request->getQueryParams();
632646

633647
// Load validation rules
634648
$schema = new RequestSchema('schema://requests/set-password.yaml');
649+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
650+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
651+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
652+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
635653
$validator = new JqueryValidationAdapter($schema, $this->ci->translator);
636654

637655
return $this->ci->view->render($response, 'pages/set-password.html.twig', [
@@ -664,6 +682,9 @@ public function pageSetPassword(Request $request, Response $response, $args)
664682
*/
665683
public function pageSettings(Request $request, Response $response, $args)
666684
{
685+
/** @var \UserFrosting\Support\Repository\Repository $config */
686+
$config = $this->ci->config;
687+
667688
/** @var \UserFrosting\Sprinkle\Account\Authorize\AuthorizationManager */
668689
$authorizer = $this->ci->authorizer;
669690

@@ -677,14 +698,15 @@ public function pageSettings(Request $request, Response $response, $args)
677698

678699
// Load validation rules
679700
$schema = new RequestSchema('schema://requests/account-settings.yaml');
701+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
702+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
703+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
704+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
680705
$validatorAccountSettings = new JqueryValidationAdapter($schema, $this->ci->translator);
681706

682707
$schema = new RequestSchema('schema://requests/profile-settings.yaml');
683708
$validatorProfileSettings = new JqueryValidationAdapter($schema, $this->ci->translator);
684709

685-
/** @var \UserFrosting\Support\Repository\Repository $config */
686-
$config = $this->ci->config;
687-
688710
// Get a list of all locales
689711
$locales = $config->getDefined('site.locales.available');
690712

@@ -919,6 +941,10 @@ public function register(Request $request, Response $response, $args)
919941

920942
// Load the request schema
921943
$schema = new RequestSchema('schema://requests/register.yaml');
944+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
945+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
946+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
947+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
922948

923949
// Whitelist and set parameter defaults
924950
$transformer = new RequestDataTransformer($schema);
@@ -1117,6 +1143,10 @@ public function setPassword(Request $request, Response $response, $args)
11171143

11181144
// Load the request schema
11191145
$schema = new RequestSchema('schema://requests/set-password.yaml');
1146+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
1147+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
1148+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
1149+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
11201150

11211151
// Whitelist and set parameter defaults
11221152
$transformer = new RequestDataTransformer($schema);
@@ -1210,6 +1240,10 @@ public function settings(Request $request, Response $response, $args)
12101240

12111241
// Load the request schema
12121242
$schema = new RequestSchema('schema://requests/account-settings.yaml');
1243+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
1244+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
1245+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
1246+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
12131247

12141248
// Whitelist and set parameter defaults
12151249
$transformer = new RequestDataTransformer($schema);

app/sprinkles/account/templates/forms/settings-account.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
{% if page.visibility != "disabled" %}
1717
<div class="form-group">
1818
<label for="input-password" class="control-label">{{translate("PASSWORD.NEW")}}</label>
19-
<input type="password" id="input-password" class="form-control" name="password" placeholder="{{translate("PASSWORD.BETWEEN", {min: 12, max: 100})}} ({{translate("OPTIONAL")}})">
19+
<input type="password" id="input-password" class="form-control" name="password" placeholder="{{translate("PASSWORD.BETWEEN", {min: site.password.length.min, max: site.password.length.max})}} ({{translate("OPTIONAL")}})">
2020
</div>
2121
<div class="form-group">
2222
<label for="input-passwordc" class="control-label">{{translate("PASSWORD.CONFIRM_NEW")}}</label>

app/sprinkles/account/templates/pages/register.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
</div>
4848
<div class="form-group">
4949
<label for="r-form-password">{{translate('PASSWORD')}}</label>
50-
<input type="password" name="password" placeholder="{{translate('PASSWORD.BETWEEN', {min: 12, max: 100})}}" class="form-control" id="r-form-password">
50+
<input type="password" name="password" placeholder="{{translate('PASSWORD.BETWEEN', {min: site.password.length.min, max: site.password.length.max})}}" class="form-control" id="r-form-password">
5151
</div>
5252
<div class="form-group">
5353
<label class="sr-only" for="r-form-passwordc">{{translate('PASSWORD.CONFIRM')}}</label>

app/sprinkles/account/templates/pages/reset-password.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<div class="form-group">
3232
<label class="sr-only" for="form-password">{{translate("PASSWORD.NEW")}}</label>
33-
<input type="password" name="password" placeholder="{{translate("PASSWORD.BETWEEN", {min: 12, max: 100})}}" class="form-control" id="form-password">
33+
<input type="password" name="password" placeholder="{{translate("PASSWORD.BETWEEN", {min: site.password.length.min, max: site.password.length.max})}}" class="form-control" id="form-password">
3434
</div>
3535

3636
<div class="form-group">

app/sprinkles/account/templates/pages/set-password.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
<div class="form-group">
3232
<label class="sr-only" for="form-password">{{translate('PASSWORD')}}</label>
33-
<input type="password" name="password" placeholder="{{translate('PASSWORD.BETWEEN', {min: 12, max: 100})}}" class="form-control" id="form-password">
33+
<input type="password" name="password" placeholder="{{translate('PASSWORD.BETWEEN', {min: site.password.length.min, max: site.password.length.max})}}" class="form-control" id="form-password">
3434
</div>
3535
<div class="form-group">
3636
<label class="sr-only" for="form-passwordc">{{translate('PASSWORD.CONFIRM')}}</label>

app/sprinkles/admin/src/Controller/RoleController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -957,6 +957,8 @@ public function updateField(Request $request, Response $response, $args)
957957

958958
// Load the request schema
959959
$schema = new RequestSchema('schema://requests/role/edit-field.yaml');
960+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
961+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
960962

961963
// Whitelist and set parameter defaults
962964
$transformer = new RequestDataTransformer($schema);

app/sprinkles/admin/src/Controller/UserController.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,9 @@ public function getModalEditPassword(Request $request, Response $response, $args
765765
/** @var \UserFrosting\Sprinkle\Account\Database\Models\Interfaces\UserInterface $currentUser */
766766
$currentUser = $this->ci->currentUser;
767767

768+
/** @var \UserFrosting\Support\Repository\Repository $config */
769+
$config = $this->ci->config;
770+
768771
// Access-controlled resource - check that currentUser has permission to edit "password" field for this user
769772
if (!$authorizer->checkAccess($currentUser, 'update_user_field', [
770773
'user' => $user,
@@ -775,6 +778,10 @@ public function getModalEditPassword(Request $request, Response $response, $args
775778

776779
// Load validation rules
777780
$schema = new RequestSchema('schema://requests/user/edit-password.yaml');
781+
$schema->set('value.validators.length.min', $config['site.password.length.min']);
782+
$schema->set('value.validators.length.max', $config['site.password.length.max']);
783+
$schema->set('passwordc.validators.length.min', $config['site.password.length.min']);
784+
$schema->set('passwordc.validators.length.max', $config['site.password.length.max']);
778785
$validator = new JqueryValidationAdapter($schema, $this->ci->translator);
779786

780787
return $this->ci->view->render($response, 'modals/user-set-password.html.twig', [
@@ -1307,6 +1314,8 @@ public function updateField(Request $request, Response $response, $args)
13071314

13081315
// Load the request schema
13091316
$schema = new RequestSchema('schema://requests/user/edit-field.yaml');
1317+
$schema->set('password.validators.length.min', $config['site.password.length.min']);
1318+
$schema->set('password.validators.length.max', $config['site.password.length.max']);
13101319

13111320
// Whitelist and set parameter defaults
13121321
$transformer = new RequestDataTransformer($schema);

0 commit comments

Comments
 (0)