chapter hgroup + calming decor
This commit is contained in:
parent
0545b131de
commit
94d14d70c1
370 changed files with 9583 additions and 1566 deletions
|
|
@ -59,7 +59,7 @@ return [
|
|||
'submit' => fn () => (new UserTotpEnableDialog())->submit()
|
||||
],
|
||||
'account.totp.disable' => [
|
||||
'pattern' => '(account)/totp/disable',
|
||||
...$dialogs['user.totp.disable'],
|
||||
'pattern' => '(account)/totp/disable',
|
||||
],
|
||||
];
|
||||
|
|
|
|||
|
|
@ -180,44 +180,57 @@ return [
|
|||
$kirby = App::instance();
|
||||
$user = Find::user($id);
|
||||
|
||||
$fields = [
|
||||
'currentPassword' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.' . ($kirby->user()->is($user) ? 'current' : 'own')),
|
||||
'autocomplete' => 'current-password',
|
||||
'help' => I18n::translate('account') . ': ' . App::instance()->user()->email(),
|
||||
]),
|
||||
'line' => [
|
||||
'type' => 'line',
|
||||
],
|
||||
'password' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.new'),
|
||||
'autocomplete' => 'new-password',
|
||||
'help' => I18n::translate('account') . ': ' . $user->email(),
|
||||
]),
|
||||
'passwordConfirmation' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.new.confirm'),
|
||||
'autocomplete' => 'new-password'
|
||||
])
|
||||
];
|
||||
|
||||
// if the currently logged in user tries to change their own password
|
||||
// and has no password so far, password confirmation can be skipped
|
||||
if ($user->isLoggedIn() === true && $user->hasPassword() === false) {
|
||||
unset($fields['currentPassword'], $fields['line']);
|
||||
}
|
||||
|
||||
return [
|
||||
'component' => 'k-form-dialog',
|
||||
'props' => [
|
||||
'fields' => [
|
||||
'currentPassword' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.' . ($kirby->user()->is($user) ? 'current' : 'own')),
|
||||
'autocomplete' => 'current-password',
|
||||
'help' => I18n::translate('account') . ': ' . App::instance()->user()->email(),
|
||||
]),
|
||||
'line' => [
|
||||
'type' => 'line',
|
||||
],
|
||||
'password' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.new'),
|
||||
'autocomplete' => 'new-password',
|
||||
'help' => I18n::translate('account') . ': ' . $user->email(),
|
||||
]),
|
||||
'passwordConfirmation' => Field::password([
|
||||
'label' => I18n::translate('user.changePassword.new.confirm'),
|
||||
'autocomplete' => 'new-password'
|
||||
])
|
||||
],
|
||||
'fields' => $fields,
|
||||
'submitButton' => I18n::translate('change'),
|
||||
]
|
||||
];
|
||||
},
|
||||
'submit' => function (string $id) {
|
||||
$kirby = App::instance();
|
||||
$request = $kirby->request();
|
||||
|
||||
$kirby = App::instance();
|
||||
$request = $kirby->request();
|
||||
$user = Find::user($id);
|
||||
$currentPassword = $request->get('currentPassword');
|
||||
$password = $request->get('password');
|
||||
$passwordConfirmation = $request->get('passwordConfirmation');
|
||||
|
||||
// if the currently logged in user tries to change their own password
|
||||
// and has no password so far, password confirmation can be skipped
|
||||
$canSkipConfirmation = $user->isLoggedIn() === true && $user->hasPassword() === false;
|
||||
|
||||
// validate the current password of the acting user
|
||||
try {
|
||||
$kirby->user()->validatePassword($currentPassword);
|
||||
if ($canSkipConfirmation === false) {
|
||||
$kirby->user()->validatePassword($currentPassword);
|
||||
}
|
||||
} catch (Exception) {
|
||||
// catching and re-throwing exception to avoid automatic
|
||||
// sign-out of current user from the Panel
|
||||
|
|
|
|||
|
|
@ -80,12 +80,14 @@ return [
|
|||
$template = $mediaRoot . '/{{ name }}{{ attributes }}.{{ extension }}';
|
||||
$thumbRoot = (new Filename($file->root(), $template, $options))->toString();
|
||||
$thumbName = basename($thumbRoot);
|
||||
$job = $mediaRoot . '/.jobs/' . $thumbName . '.json';
|
||||
|
||||
// check if the thumb already exists
|
||||
if (file_exists($thumbRoot) === false) {
|
||||
// check if the thumb or job file already exists
|
||||
if (
|
||||
file_exists($thumbRoot) === false &&
|
||||
file_exists($job) === false
|
||||
) {
|
||||
// if not, create job file
|
||||
$job = $mediaRoot . '/.jobs/' . $thumbName . '.json';
|
||||
|
||||
try {
|
||||
Data::write(
|
||||
$job,
|
||||
|
|
|
|||
|
|
@ -251,6 +251,9 @@ return function (App $app) {
|
|||
Field $field,
|
||||
string $separator = 'yaml'
|
||||
) use ($app): Pages {
|
||||
// always pass at least two arguments even if the
|
||||
// data is empty so that `$site->find()` always
|
||||
// returns a collection, not a single page
|
||||
return $app->site()->find(
|
||||
false,
|
||||
false,
|
||||
|
|
@ -320,6 +323,9 @@ return function (App $app) {
|
|||
Field $field,
|
||||
string $separator = 'yaml'
|
||||
) use ($app): Users {
|
||||
// always pass at least two arguments even if the
|
||||
// data is empty so that `$users->find()` always
|
||||
// returns a collection, not a single user
|
||||
return $app->users()->find(
|
||||
false,
|
||||
false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue