Upgrade to 3.2.3
This commit is contained in:
@@ -35,7 +35,7 @@ return [
|
||||
'requirements' => function (System $system) {
|
||||
return $system->toArray();
|
||||
},
|
||||
'breadcrumbTitle' => function () {
|
||||
'site' => function () {
|
||||
try {
|
||||
return $this->site()->blueprint()->title();
|
||||
} catch (Throwable $e) {
|
||||
@@ -90,7 +90,6 @@ return [
|
||||
],
|
||||
'panel' => [
|
||||
'ascii',
|
||||
'breadcrumbTitle',
|
||||
'isOk',
|
||||
'isInstalled',
|
||||
'isLocal',
|
||||
@@ -99,6 +98,7 @@ return [
|
||||
'license',
|
||||
'multilang',
|
||||
'requirements',
|
||||
'site',
|
||||
'slugs',
|
||||
'title',
|
||||
'translation',
|
||||
|
@@ -35,25 +35,13 @@ return [
|
||||
$long = $this->requestBody('long');
|
||||
$password = $this->requestBody('password');
|
||||
|
||||
try {
|
||||
if ($user = $this->kirby()->auth()->login($email, $password, $long)) {
|
||||
return [
|
||||
'code' => 200,
|
||||
'status' => 'ok',
|
||||
'user' => $this->resolve($user)->view('auth')->toArray()
|
||||
];
|
||||
}
|
||||
$user = $this->kirby()->auth()->login($email, $password, $long);
|
||||
|
||||
throw new NotFoundException(['key' => 'user.undefined']);
|
||||
} catch (Throwable $e) {
|
||||
if ($this->kirby()->option('debug') === true) {
|
||||
throw $e;
|
||||
} else {
|
||||
// catch any kind of login error
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('Invalid email or password');
|
||||
return [
|
||||
'code' => 200,
|
||||
'status' => 'ok',
|
||||
'user' => $this->resolve($user)->view('auth')->toArray()
|
||||
];
|
||||
}
|
||||
],
|
||||
[
|
||||
|
@@ -1,37 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Kirby\Exception\Exception;
|
||||
|
||||
/**
|
||||
* Content Lock Routes
|
||||
*/
|
||||
return [
|
||||
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $path) {
|
||||
return $this->parent($path)->lock()->get();
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return [
|
||||
'supported' => true,
|
||||
'locked' => $lock->get()
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'supported' => false,
|
||||
'locked' => null
|
||||
];
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $path) {
|
||||
return $this->parent($path)->lock()->create();
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->create();
|
||||
}
|
||||
|
||||
throw new Exception([
|
||||
'key' => 'lock.notImplemented',
|
||||
'httpCode' => 501
|
||||
]);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/lock',
|
||||
'method' => 'DELETE',
|
||||
'action' => function (string $path) {
|
||||
return $this->parent($path)->lock()->remove();
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->remove();
|
||||
}
|
||||
|
||||
throw new Exception([
|
||||
'key' => 'lock.notImplemented',
|
||||
'httpCode' => 501
|
||||
]);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/unlock',
|
||||
'method' => 'GET',
|
||||
'action' => function (string $path) {
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return [
|
||||
'supported' => true,
|
||||
'unlocked' => $lock->isUnlocked()
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'isUnlocked' => $this->parent($path)->lock()->isUnlocked()
|
||||
'supported' => false,
|
||||
'unlocked' => null
|
||||
];
|
||||
}
|
||||
],
|
||||
@@ -39,14 +72,28 @@ return [
|
||||
'pattern' => '(:all)/unlock',
|
||||
'method' => 'PATCH',
|
||||
'action' => function (string $path) {
|
||||
return $this->parent($path)->lock()->unlock();
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->unlock();
|
||||
}
|
||||
|
||||
throw new Exception([
|
||||
'key' => 'lock.notImplemented',
|
||||
'httpCode' => 501
|
||||
]);
|
||||
}
|
||||
],
|
||||
[
|
||||
'pattern' => '(:all)/unlock',
|
||||
'method' => 'DELETE',
|
||||
'action' => function (string $path) {
|
||||
return $this->parent($path)->lock()->resolve();
|
||||
if ($lock = $this->parent($path)->lock()) {
|
||||
return $lock->resolve();
|
||||
}
|
||||
|
||||
throw new Exception([
|
||||
'key' => 'lock.notImplemented',
|
||||
'httpCode' => 501
|
||||
]);
|
||||
}
|
||||
],
|
||||
];
|
||||
|
Reference in New Issue
Block a user