shoppingmallv2 init...
This commit is contained in:
parent
3ee454bfd9
commit
6ea7faec41
@ -66,6 +66,7 @@ class UserController extends AdminController
|
|||||||
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
|
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'role':
|
case 'role':
|
||||||
|
//checkbox형태로 들어오면 $fieldDatas['role']가 array이기때문에
|
||||||
$rules[$field . '.*'] = $rule;
|
$rules[$field . '.*'] = $rule;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -73,14 +74,6 @@ class UserController extends AdminController
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//fieldData Rule 검사
|
parent::insert_validate();
|
||||||
if (!$this->validate($rules)) {
|
|
||||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->validator->getErrors()));
|
|
||||||
}
|
|
||||||
//fieldData 적용
|
|
||||||
$this->_viewDatas['fieldDatas'] = array();
|
|
||||||
foreach ($this->_viewDatas['fields'] as $field) {
|
|
||||||
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -206,10 +206,13 @@ abstract class BaseController extends Controller
|
|||||||
$this->_viewDatas['fieldDatas'] = array();
|
$this->_viewDatas['fieldDatas'] = array();
|
||||||
foreach ($this->_viewDatas['fields'] as $field) {
|
foreach ($this->_viewDatas['fields'] as $field) {
|
||||||
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
|
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
|
||||||
log_message(
|
//보안문제,사용자정보의 update시 암호를 변경하지 않느경우를 위해
|
||||||
"info",
|
if ($field != 'passwd') {
|
||||||
"{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
|
log_message(
|
||||||
);
|
"info",
|
||||||
|
"{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
protected function update_process($entity)
|
protected function update_process($entity)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class LocalAdapter extends Adapter
|
|||||||
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
|
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
|
||||||
throw new \Exception("ID 나 암호의 값이 없습니다.");
|
throw new \Exception("ID 나 암호의 값이 없습니다.");
|
||||||
}
|
}
|
||||||
$entity = $this->getUserModel()->getEntity(['id' => $formDatas['id']]);
|
$entity = $this->getUserModel()->getEntity(['id' => $formDatas['id'], 'status' => DEFAULTS['STATUS']]);
|
||||||
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
|
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
|
||||||
throw new \Exception("암호가 맞지않습니다.");
|
throw new \Exception("암호가 맞지않습니다.");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,7 +67,7 @@ abstract class BaseModel extends Model
|
|||||||
abstract public function getTitleField(): string;
|
abstract public function getTitleField(): string;
|
||||||
public function getEntity($conditions): BaseEntity
|
public function getEntity($conditions): BaseEntity
|
||||||
{
|
{
|
||||||
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.\n" . var_export($conditions, true));
|
return $this->where($conditions)->first() ?: throw new \Exception(__FUNCTION__ . "에서 {$this->getClassName()}의 해당 데이터가 없습니다.");
|
||||||
}
|
}
|
||||||
public function getEntitys(array $conditions = array()): array
|
public function getEntitys(array $conditions = array()): array
|
||||||
{
|
{
|
||||||
@ -201,8 +201,6 @@ abstract class BaseModel extends Model
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "passwd":
|
case "passwd":
|
||||||
// echo var_export($this->validationRules, true);
|
|
||||||
// exit;
|
|
||||||
if (array_key_exists($field, $formDatas)) {
|
if (array_key_exists($field, $formDatas)) {
|
||||||
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
|
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user