Permalink
Browse files

Field user and alias should be locked

  • Loading branch information...
redaxmedia committed Jul 24, 2018
1 parent 8f4e9ec commit c2601dad0611ecb16c3c79ba93963abe4b39ece8
View
@@ -1,10 +1,10 @@
<?php
return
[
'dbType' => null,
'dbHost' => null,
'dbType' => 'sqlite',
'dbHost' => 'test2.sqlite',
'dbPrefix' => null,
'dbName' => null,
'dbUser' => null,
'dbPassword' => null
];
'dbUser' => 'test',
'dbPassword' => 'test'
];
@@ -81,7 +81,6 @@ public function process(string $action = null) : string
$updateArray =
[
'name' => $postArray['name'],
'alias' => $postArray['alias'],
'description' => $postArray['description'],
'categories' => $postArray['categories'],
'articles' => $postArray['articles'],
@@ -170,17 +169,20 @@ protected function _validatePost(array $postArray = []) : array
{
$validateArray[] = $this->_language->get('name_empty');
}
if (!$postArray['alias'])
{
$validateArray[] = $this->_language->get('alias_empty');
}
else if ($aliasValidator->validate($postArray['alias'], 'general'))
if (!$postArray['id'])
{
$validateArray[] = $this->_language->get('alias_incorrect');
}
else if ($groupModel->getByAlias($postArray['alias'])->id !== $groupModel->getById($postArray['id'])->id)
{
$validateArray[] = $this->_language->get('alias_exists');
if (!$postArray['alias'])
{
$validateArray[] = $this->_language->get('alias_empty');
}
else if ($aliasValidator->validate($postArray['alias'], 'general'))
{
$validateArray[] = $this->_language->get('alias_incorrect');
}
else if ($groupModel->getByAlias($postArray['alias'])->id !== $groupModel->getById($postArray['id'])->id)
{
$validateArray[] = $this->_language->get('alias_exists');
}
}
return $validateArray;
}
@@ -156,17 +156,20 @@ protected function _validatePost(array $postArray = []) : array
{
$validateArray[] = $this->_language->get('name_empty');
}
if (!$postArray['user'])
{
$validateArray[] = $this->_language->get('user_empty');
}
else if ($loginValidator->validate($postArray['user'], 'general'))
{
$validateArray[] = $this->_language->get('user_incorrect');
}
else if ($userModel->getByUser($postArray['user'])->id !== $userModel->getById($postArray['id'])->id)
{
$validateArray[] = $this->_language->get('user_exists');
if (!$postArray['id'])
{
if (!$postArray['user'])
{
$validateArray[] = $this->_language->get('user_empty');
}
else if ($loginValidator->validate($postArray['user']))
{
$validateArray[] = $this->_language->get('user_incorrect');
}
else if ($userModel->getByUser($postArray['user'])->id !== $userModel->getById($postArray['id'])->id)
{
$validateArray[] = $this->_language->get('user_exists');
}
}
if (!$postArray['password'])
{
@@ -67,7 +67,6 @@ public function updateByIdAndArray(int $groupId = null, array $updateArray = [])
->set(
[
'name' => $updateArray['name'],
'alias' => $updateArray['alias'],
'description' => $updateArray['description'],
'categories' => $updateArray['categories'],
'articles' => $updateArray['articles'],
@@ -62,7 +62,6 @@ public function updateByIdAndArray(int $userId = null, array $updateArray = [])
->set(
[
'name' => $updateArray['name'],
'user' => $updateArray['user'],
'description' => $updateArray['description'],
'password' => $updateArray['password'],
'email' => $updateArray['email'],
@@ -105,20 +105,27 @@ public function render(int $groupId = null) : string
'required' => 'required',
'value' => $group->name
])
->append('</li><li>')
->label($this->_language->get('alias'),
[
'for' => 'alias'
])
->text(
[
'id' => 'alias',
'name' => 'alias',
'pattern' => '[a-zA-Z0-9-]+',
'required' => 'required',
'value' => $group->alias
])
->append('</li><li>')
->append('</li>');
if (!$group->id)
{
$formElement
->append('<li>')
->label($this->_language->get('alias'),
[
'for' => 'alias'
])
->text(
[
'id' => 'alias',
'name' => 'alias',
'pattern' => '[a-zA-Z0-9-]+',
'required' => 'required',
'value' => $group->alias
])
->append('</li>');
}
$formElement
->append('<li>')
->label($this->_language->get('description'),
[
'for' => 'description'

0 comments on commit c2601da

Please sign in to comment.