shoppingmallv2 init...

This commit is contained in:
최준흠git config git config --helpgit config --global user.name 최준흠 2023-08-06 15:16:32 +09:00
parent 3ee454bfd9
commit 6ea7faec41
4 changed files with 11 additions and 17 deletions

View File

@ -66,6 +66,7 @@ class UserController extends AdminController
foreach ($this->_viewDatas['fieldRules'] as $field => $rule) {
switch ($field) {
case 'role':
//checkbox형태로 들어오면 $fieldDatas['role']가 array이기때문에
$rules[$field . '.*'] = $rule;
break;
default:
@ -73,14 +74,6 @@ class UserController extends AdminController
break;
}
}
//fieldData Rule 검사
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);
}
parent::insert_validate();
}
}

View File

@ -206,10 +206,13 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldDatas'] = array();
foreach ($this->_viewDatas['fields'] as $field) {
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
log_message(
"info",
"{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
);
//보안문제,사용자정보의 update시 암호를 변경하지 않느경우를 위해
if ($field != 'passwd') {
log_message(
"info",
"{$field} : {$entity->$field} => " . var_export($this->_viewDatas['fieldDatas'][$field])
);
}
}
}
protected function update_process($entity)

View File

@ -21,7 +21,7 @@ class LocalAdapter extends Adapter
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
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)) {
throw new \Exception("암호가 맞지않습니다.");
}

View File

@ -67,7 +67,7 @@ abstract class BaseModel extends Model
abstract public function getTitleField(): string;
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
{
@ -201,8 +201,6 @@ abstract class BaseModel extends Model
}
break;
case "passwd":
// echo var_export($this->validationRules, true);
// exit;
if (array_key_exists($field, $formDatas)) {
$entity->$field = password_hash($formDatas[$field], PASSWORD_DEFAULT);
}