Skip to content

Commit 5b5da40

Browse files
committed
Merge branch 'v5/develop' into v51/feature/query-ast
2 parents 19fc6a0 + 0718b62 commit 5b5da40

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1533
-303
lines changed

config/api/routes/users.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,23 @@ function ($source, $filename) use ($id) {
184184
],
185185
'method' => 'PATCH',
186186
'action' => function (string $id) {
187-
return $this->user($id)->changePassword($this->requestBody('password'));
187+
$user = $this->user($id);
188+
189+
// validate password of acting user unless they have logged in to reset it;
190+
// always validate password of acting user when changing password of other users
191+
if ($this->session()->get('kirby.resetPassword') !== true || $this->user()->is($user) !== true) {
192+
$this->user()->validatePassword($this->requestBody('currentPassword'));
193+
}
194+
195+
$result = $user->changePassword($this->requestBody('password'));
196+
197+
// if we changed the password of the current user…
198+
if ($user->isLoggedIn() === true) {
199+
// …don't allow additional resets (now the password is known again)
200+
$this->session()->remove('kirby.resetPassword');
201+
}
202+
203+
return $result;
188204
}
189205
],
190206
[

config/areas/account/views.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
[
2727
'label' => I18n::translate('view.resetPassword')
2828
]
29+
],
30+
'props' => [
31+
'requirePassword' => App::instance()->session()->get('kirby.resetPassword') !== true
2932
]
3033
]
3134
]

config/fields/number.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@
2424
},
2525
/**
2626
* Allowed incremental steps between numbers (i.e `0.5`)
27+
* Use `any` to allow any decimal value.
2728
*/
28-
'step' => function ($step = null) {
29-
return $this->toNumber($step) ?? '';
29+
'step' => function ($step = null): float|string {
30+
return match ($step) {
31+
'any' => 'any',
32+
default => $this->toNumber($step) ?? ''
33+
};
3034
},
3135
'value' => function ($value = null) {
3236
return $this->toNumber($value) ?? '';
3337
}
3438
],
3539
'methods' => [
36-
'toNumber' => function ($value) {
40+
'toNumber' => function ($value): float|null {
3741
if ($this->isEmptyValue($value) === true) {
3842
return null;
3943
}

config/fields/select.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22

33
use Kirby\Field\FieldOptions;
4+
use Kirby\Toolkit\I18n;
45

56
return [
67
'extends' => 'radio',
@@ -19,8 +20,8 @@
1920
/**
2021
* Text shown when no option is selected yet
2122
*/
22-
'placeholder' => function (string $placeholder = '') {
23-
return $placeholder;
23+
'placeholder' => function (string|array $placeholder = '') {
24+
return I18n::translate($placeholder, $placeholder);
2425
},
2526
],
2627
'methods' => [

panel/dist/js/index.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

panel/dist/js/vendor.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

panel/dist/ui/FormControls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"description":"","displayName":"FormControls","tags":{"since":[{"description":"5.0.0","title":"since"}]},"props":[{"name":"editor","type":{"name":"string"}},{"name":"hasChanges","type":{"name":"boolean"}},{"name":"isLocked","type":{"name":"boolean"}},{"name":"modified","type":{"name":"string|date"}},{"name":"preview","description":"Preview URL for changes","type":{"name":"string|boolean"}}],"events":[{"name":"discard"},{"name":"submit"}],"component":"k-form-controls","sourceFile":"src/components/Forms/FormControls.vue"}
1+
{"description":"","displayName":"FormControls","tags":{"since":[{"description":"5.0.0","title":"since"}]},"props":[{"name":"editor","type":{"name":"string"}},{"name":"hasDiff","type":{"name":"boolean"}},{"name":"isLocked","type":{"name":"boolean"}},{"name":"modified","type":{"name":"string|date"}},{"name":"preview","description":"Preview URL for changes","type":{"name":"string|boolean"}}],"events":[{"name":"discard"},{"name":"submit"}],"component":"k-form-controls","sourceFile":"src/components/Forms/FormControls.vue"}

panel/dist/ui/ModelTabs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"description":"","tags":{"since":[{"description":"4.0.0","title":"since"}]},"displayName":"ModelTabs","props":[{"name":"changes","type":{"name":"object"}},{"name":"tab","type":{"name":"string"}},{"name":"tabs","type":{"name":"array"},"defaultValue":{"value":"[]"}}],"component":"k-model-tabs","sourceFile":"src/components/Navigation/ModelTabs.vue"}
1+
{"description":"","tags":{"since":[{"description":"4.0.0","title":"since"}]},"displayName":"ModelTabs","props":[{"name":"diff","type":{"name":"object"}},{"name":"tab","type":{"name":"string"}},{"name":"tabs","type":{"name":"array"},"defaultValue":{"value":"[]"}}],"component":"k-model-tabs","sourceFile":"src/components/Navigation/ModelTabs.vue"}

panel/dist/ui/NumberField.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"displayName":"NumberField","description":"Have a look at `<k-field>`, `<k-input>` and `<k-number-input>` for additional information.","tags":{"examples":[{"title":"example","content":"<k-number-field :value=\"number\" @input=\"number = $event\" name=\"number\" label=\"Number\" />"}]},"props":[{"name":"disabled","description":"If `true`, the field is no longer editable and will not be saved","type":{"name":"boolean"}},{"name":"help","description":"Optional help text below the field","type":{"name":"string"}},{"name":"id","description":"A unique ID. The component `_uid` will be used as default.","type":{"name":"number|string"},"defaultValue":{"value":"function() {\n return this._uid;\n}"}},{"name":"label","description":"A descriptive label for the field","type":{"name":"string"}},{"name":"name","description":"A unique name for the input","type":{"name":"number|string"}},{"name":"required","description":"If `true`, the field has to be filled in correctly to be submitted","type":{"name":"boolean"}},{"name":"counter","type":{"name":"boolean|object"}},{"name":"endpoints","type":{"name":"object"}},{"name":"input","type":{"name":"string|number"}},{"name":"translate","type":{"name":"boolean"}},{"name":"type","type":{"name":"string"}},{"name":"after","description":"Optional text that will be shown after the input","type":{"name":"string"}},{"name":"before","description":"Optional text that will be shown before the input","type":{"name":"string"}},{"name":"autofocus","type":{"name":"boolean"}},{"name":"icon","type":{"name":"string|boolean"}},{"name":"value","type":{"name":"number|string"},"defaultValue":{"value":"\"\""}},{"name":"placeholder","description":"Custom placeholder text, when the field is empty","type":{"name":"number|string"}},{"name":"max","type":{"name":"number"}},{"name":"min","type":{"name":"number"}},{"name":"preselect","type":{"name":"boolean"}},{"name":"step","description":"The amount to increment with each input step. This can be a decimal.","type":{"name":"number|string"}}],"events":[{"name":"input"},{"name":"focus"},{"name":"blur"}],"slots":[{"name":"header"},{"name":"label"},{"name":"options"},{"name":"counter"},{"name":"default"},{"name":"footer"},{"name":"help"},{"name":"before"},{"name":"after"},{"name":"icon"}],"component":"k-number-field","sourceFile":"src/components/Forms/Field/NumberField.vue"}
1+
{"displayName":"NumberField","description":"Have a look at `<k-field>`, `<k-input>` and `<k-number-input>` for additional information.","tags":{"examples":[{"title":"example","content":"<k-number-field :value=\"number\" @input=\"number = $event\" name=\"number\" label=\"Number\" />"}]},"props":[{"name":"disabled","description":"If `true`, the field is no longer editable and will not be saved","type":{"name":"boolean"}},{"name":"help","description":"Optional help text below the field","type":{"name":"string"}},{"name":"id","description":"A unique ID. The component `_uid` will be used as default.","type":{"name":"number|string"},"defaultValue":{"value":"function() {\n return this._uid;\n}"}},{"name":"label","description":"A descriptive label for the field","type":{"name":"string"}},{"name":"name","description":"A unique name for the input","type":{"name":"number|string"}},{"name":"required","description":"If `true`, the field has to be filled in correctly to be submitted","type":{"name":"boolean"}},{"name":"counter","type":{"name":"boolean|object"}},{"name":"endpoints","type":{"name":"object"}},{"name":"input","type":{"name":"string|number"}},{"name":"translate","type":{"name":"boolean"}},{"name":"type","type":{"name":"string"}},{"name":"after","description":"Optional text that will be shown after the input","type":{"name":"string"}},{"name":"before","description":"Optional text that will be shown before the input","type":{"name":"string"}},{"name":"autofocus","type":{"name":"boolean"}},{"name":"icon","type":{"name":"string|boolean"}},{"name":"value","type":{"name":"number|string"},"defaultValue":{"value":"\"\""}},{"name":"placeholder","description":"Custom placeholder text, when the field is empty","type":{"name":"number|string"}},{"name":"max","type":{"name":"number"}},{"name":"min","type":{"name":"number"}},{"name":"preselect","type":{"name":"boolean"}},{"name":"step","description":"The amount to increment with each input step. This can be a decimal.\nUse \"any\" to allow any decimal value.","type":{"name":"number|string"}}],"events":[{"name":"input"},{"name":"focus"},{"name":"blur"}],"slots":[{"name":"header"},{"name":"label"},{"name":"options"},{"name":"counter"},{"name":"default"},{"name":"footer"},{"name":"help"},{"name":"before"},{"name":"after"},{"name":"icon"}],"component":"k-number-field","sourceFile":"src/components/Forms/Field/NumberField.vue"}

panel/dist/ui/NumberInput.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"displayName":"NumberInput","description":"","tags":{"examples":[{"title":"example","content":"<k-input :value=\"number\" @input=\"number = $event\" name=\"number\" type=\"number\" />"}]},"props":[{"name":"autofocus","description":"Sets the focus on this field when the form loads. Only the first field with this label gets","type":{"name":"boolean"}},{"name":"disabled","description":"If `true`, the field is no longer editable and will not be saved","type":{"name":"boolean"}},{"name":"id","description":"A unique ID. The component `_uid` will be used as default.","type":{"name":"number|string"},"defaultValue":{"value":"function() {\n return this._uid;\n}"}},{"name":"name","description":"A unique name for the input","type":{"name":"number|string"}},{"name":"required","description":"If `true`, the field has to be filled in correctly to be submitted","type":{"name":"boolean"}},{"name":"placeholder","description":"Custom placeholder text, when the field is empty","type":{"name":"number|string"}},{"name":"max","type":{"name":"number"}},{"name":"min","type":{"name":"number"}},{"name":"preselect","type":{"name":"boolean"}},{"name":"step","description":"The amount to increment with each input step. This can be a decimal.","type":{"name":"number|string"}},{"name":"value","type":{"name":"number|string"},"defaultValue":{"value":"\"\""}}],"events":[{"name":"input","type":{"names":["undefined"]}}],"methods":[{"name":"focus","description":"Focuses the input element","tags":{"access":[{"description":"public"}]}}],"component":"k-number-input","sourceFile":"src/components/Forms/Input/NumberInput.vue"}
1+
{"displayName":"NumberInput","description":"","tags":{"examples":[{"title":"example","content":"<k-input :value=\"number\" @input=\"number = $event\" name=\"number\" type=\"number\" />"}]},"props":[{"name":"autofocus","description":"Sets the focus on this field when the form loads. Only the first field with this label gets","type":{"name":"boolean"}},{"name":"disabled","description":"If `true`, the field is no longer editable and will not be saved","type":{"name":"boolean"}},{"name":"id","description":"A unique ID. The component `_uid` will be used as default.","type":{"name":"number|string"},"defaultValue":{"value":"function() {\n return this._uid;\n}"}},{"name":"name","description":"A unique name for the input","type":{"name":"number|string"}},{"name":"required","description":"If `true`, the field has to be filled in correctly to be submitted","type":{"name":"boolean"}},{"name":"placeholder","description":"Custom placeholder text, when the field is empty","type":{"name":"number|string"}},{"name":"max","type":{"name":"number"}},{"name":"min","type":{"name":"number"}},{"name":"preselect","type":{"name":"boolean"}},{"name":"step","description":"The amount to increment with each input step. This can be a decimal.\nUse \"any\" to allow any decimal value.","type":{"name":"number|string"}},{"name":"value","type":{"name":"number|string"},"defaultValue":{"value":"\"\""}}],"events":[{"name":"input","type":{"names":["undefined"]}}],"methods":[{"name":"focus","description":"Focuses the input element","tags":{"access":[{"description":"public"}]}}],"component":"k-number-input","sourceFile":"src/components/Forms/Input/NumberInput.vue"}

panel/lab/components/inputs/number/index.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
<k-number-input :step="0.01" :value="value" @input="value = $event" />
4747
</k-lab-example>
4848

49+
<k-lab-example label="Step: any">
50+
<k-number-input step="any" :value="value" @input="value = $event" />
51+
</k-lab-example>
52+
4953
<k-lab-example label="Min: 5">
5054
<k-number-input :min="5" :value="value" @input="value = $event" />
5155
</k-lab-example>

0 commit comments

Comments
 (0)