public static function modModPostBefore(&$post) { if (isset($post['password']) && $post['password']) { if (strlen($post['password']) < 6) { tiny\Error::echoJson(-3, 'password must have 6 character at least'); } $post['password'] = tiny\Auth::getPassword($post['password'], false); } else { if (isset($post['id'])) { $adminModel = new \Demo\Model\Admin(); $admin = $adminModel->findOne($post['id']); $post['password'] = $admin->password; } } }
public static function modModSetting() { return ['id' => '', 'js' => '', 'mod' => [['title' => adminModel::attributes()['id'], 'name' => 'id', 'type' => 'hidden', 'display' => false], ['title' => adminModel::attributes()['group_id'], 'name' => 'group_id', 'type' => 'select', 'option' => $group = Group::groupEnum()], ['title' => adminModel::attributes()['name'], 'name' => 'name', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['true_name'], 'name' => 'true_name', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['department'], 'name' => 'department', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['tel'], 'name' => 'tel', 'type' => 'input'], ['title' => adminModel::attributes()['password'], 'name' => 'password', 'value' => '', 'type' => 'password', 'require' => true]]]; }