mirror of
https://github.com/Karaka-Management/oms-Admin.git
synced 2026-02-07 08:48:40 +00:00
bug fixes
This commit is contained in:
parent
3934e32c78
commit
1b706dea64
2
.github/workflows/greetings.yml
vendored
2
.github/workflows/greetings.yml
vendored
|
|
@ -9,5 +9,5 @@ jobs:
|
|||
- uses: actions/first-interaction@v1
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
issue-message: 'Thank you for createing this issue. We will check it as soon as possible.'
|
||||
issue-message: 'Thank you for creating this issue. We will check it as soon as possible.'
|
||||
pr-message: 'Thank you for your pull request. We will check it as soon as possible.'
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ final class Installer extends InstallerAbstract
|
|||
->into('language');
|
||||
|
||||
$querySqlite = new Builder($sqlite);
|
||||
$languages = $querySqlite->select('*')->from('language')->execute();
|
||||
$languages = $querySqlite->select('*')->from('language')->execute()->fetchAll();
|
||||
|
||||
if ($languages === null) {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1569,15 +1569,38 @@ final class ApiController extends Controller
|
|||
*/
|
||||
public function apiAccountFind(RequestAbstract $request, ResponseAbstract $response, array $data = []) : void
|
||||
{
|
||||
$fullName = $request->getDataString('search') ?? '';
|
||||
$names = \explode(' ', $fullName);
|
||||
|
||||
$limit = $request->getDataInt('limit') ?? 50;
|
||||
|
||||
/** @var \Modules\Admin\Models\Account[] $accounts */
|
||||
$accounts = AccountMapper::getAll()
|
||||
->where('login', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE')
|
||||
->where('email', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR')
|
||||
->where('name1', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR')
|
||||
->where('name2', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR')
|
||||
->where('name3', '%' . ($request->getDataString('search') ?? '') . '%', 'LIKE', 'OR')
|
||||
->where('login', '%' . $fullName . '%', 'LIKE')
|
||||
->where('email', '%' . $fullName . '%', 'LIKE', 'OR')
|
||||
->where('name1', '%' . $fullName . '%', 'LIKE', 'OR')
|
||||
->where('name2', '%' . $fullName . '%', 'LIKE', 'OR')
|
||||
->where('name3', '%' . $fullName . '%', 'LIKE', 'OR')
|
||||
->limit($limit)
|
||||
->executeGetArray();
|
||||
|
||||
if (($count = \count($accounts)) < $limit) {
|
||||
$mapper = AccountMapper::getAll();
|
||||
foreach ($names as $name) {
|
||||
$mapper->where('login', '%' . $name . '%', 'LIKE', 'OR')
|
||||
->where('email', '%' . $name . '%', 'LIKE', 'OR')
|
||||
->where('name1', '%' . $name . '%', 'LIKE', 'OR')
|
||||
->where('name2', '%' . $name . '%', 'LIKE', 'OR')
|
||||
->where('name3', '%' . $name . '%', 'LIKE', 'OR');
|
||||
}
|
||||
|
||||
/** @var \Modules\Admin\Models\Account[] $parts */
|
||||
$parts = $mapper->limit($limit - $count)
|
||||
->executeGetArray();
|
||||
|
||||
$accounts += $parts;
|
||||
}
|
||||
|
||||
$response->header->set('Content-Type', MimeType::M_JSON, true);
|
||||
$response->set(
|
||||
$request->uri->__toString(),
|
||||
|
|
|
|||
|
|
@ -91,4 +91,50 @@ class Account extends \phpOMS\Account\Account
|
|||
|
||||
return new NullContact();
|
||||
}
|
||||
|
||||
public static function fromJson(array $account) : self
|
||||
{
|
||||
$new = new self();
|
||||
$new->from($account);
|
||||
|
||||
$new->tries = $account['tries'] ?? 0;
|
||||
|
||||
foreach (($account['addresses'] ?? []) as $address) {
|
||||
$new->addresses[] = \phpOMS\Stdlib\Base\Address::fromJson($address);
|
||||
}
|
||||
|
||||
foreach (($account['contacts'] ?? []) as $contact) {
|
||||
$new->contacts[] = Contact::fromJson($contact);
|
||||
}
|
||||
|
||||
foreach (($account['parents'] ?? []) as $parent) {
|
||||
$new->parents[] = self::fromJson($parent);
|
||||
}
|
||||
|
||||
return $new;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return \array_merge(
|
||||
parent::toArray(),
|
||||
[
|
||||
'tries' => $this->tries,
|
||||
'addresses' => $this->addresses,
|
||||
'contacts' => $this->contacts,
|
||||
'parents' => $this->parents,
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,8 +174,7 @@ class AccountMapper extends DataMapperFactory
|
|||
where `group`.group_status = 1;
|
||||
*/
|
||||
|
||||
/** @var \Modules\Admin\Models\Account $account */
|
||||
$account = self::get()
|
||||
return self::get()
|
||||
->with('groups')
|
||||
->with('groups/permissions')
|
||||
->with('permissions')
|
||||
|
|
@ -184,8 +183,6 @@ class AccountMapper extends DataMapperFactory
|
|||
->where('permissions/element', null)
|
||||
->where('groups/permissions/element', null)
|
||||
->execute();
|
||||
|
||||
return $account;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -234,6 +231,7 @@ class AccountMapper extends DataMapperFactory
|
|||
}
|
||||
|
||||
if (\password_verify($password, $result['account_password'] ?? '')) {
|
||||
$query = new Builder(self::$db);
|
||||
$query->update('account')
|
||||
->set([
|
||||
'account_lactive' => new \DateTime('now'),
|
||||
|
|
@ -250,6 +248,7 @@ class AccountMapper extends DataMapperFactory
|
|||
&& (new \DateTime('now'))->getTimestamp() < (new \DateTime($result['account_password_temp_limit']))->getTimestamp()
|
||||
&& \password_verify($password, $result['account_password_temp'] ?? '')
|
||||
) {
|
||||
$query = new Builder(self::$db);
|
||||
$query->update('account')
|
||||
->set([
|
||||
'account_password_temp' => '',
|
||||
|
|
@ -262,6 +261,7 @@ class AccountMapper extends DataMapperFactory
|
|||
return $result['account_id'];
|
||||
}
|
||||
|
||||
$query = new Builder(self::$db);
|
||||
$query->update('account')
|
||||
->set([
|
||||
'account_tries' => $result['account_tries'] + 1,
|
||||
|
|
|
|||
|
|
@ -59,4 +59,38 @@ class Contact
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public string $content = '';
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function jsonSerialize() : mixed
|
||||
{
|
||||
return $this->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function toArray() : array
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'type' => $this->type,
|
||||
'subtype' => $this->subtype,
|
||||
'title' => $this->title,
|
||||
'content' => $this->content,
|
||||
];
|
||||
}
|
||||
|
||||
public static function fromJson(array $address) : self
|
||||
{
|
||||
$new = new self();
|
||||
$new->id = $address['id'];
|
||||
$new->type = $address['type'];
|
||||
$new->subtype = $address['subtype'];
|
||||
$new->title = $address['title'];
|
||||
$new->content = $address['content'];
|
||||
|
||||
return $new;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
<th data-name="name"><?= $this->getHtml('Name'); ?>
|
||||
<th data-name="address"><?= $this->getHtml('Address'); ?>
|
||||
<th data-name="city"><?= $this->getHtml('City'); ?>
|
||||
<th data-name="zip"><?= $this->getHtml('Zip'); ?>
|
||||
<th data-name="zip"><?= $this->getHtml('Postal'); ?>
|
||||
<th data-name="country"><?= $this->getHtml('Country'); ?>
|
||||
<tbody data-action='[
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ return ['Admin' => [
|
|||
'Warnings' => 'Warnungen',
|
||||
'Website' => 'Webseite',
|
||||
'Weight' => 'Gewicht',
|
||||
'Zip' => 'Reißverschluss',
|
||||
'Postal' => 'Reißverschluss',
|
||||
'active' => 'aktiv',
|
||||
'available' => 'verfügbar',
|
||||
'i:LoginRetries' => 'Betrag der erlaubten Wiederholungen (-1 = unbegrenzt)',
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ return ['Admin' => [
|
|||
'Warnings' => 'Warnings',
|
||||
'Website' => 'Website',
|
||||
'Weight' => 'Weight',
|
||||
'Zip' => 'Zip',
|
||||
'Postal' => 'Postal',
|
||||
'active' => 'active',
|
||||
'available' => 'available',
|
||||
'i:LoginRetries' => 'Amount of allowed retries (-1 = unlimited)',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user