servermgrv2 init...
This commit is contained in:
parent
f46e85cea7
commit
2d63bb30e1
@ -36,8 +36,8 @@ $routes->addPlaceholder('uuid', '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}
|
|||||||
|
|
||||||
$routes->get('/', 'Home::index');
|
$routes->get('/', 'Home::index');
|
||||||
$routes->get('/login', 'AuthController::login');
|
$routes->get('/login', 'AuthController::login');
|
||||||
$routes->post('/signin', 'AuthController::signin/local');
|
$routes->post('/signup', 'AuthController::signup/local');
|
||||||
$routes->get('/signin/(:alpha)', 'AuthController::signin/$1');
|
$routes->get('/signup/(:alpha)', 'AuthController::signup/$1');
|
||||||
$routes->get('/logout', 'AuthController::logout');
|
$routes->get('/logout', 'AuthController::logout');
|
||||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||||
});
|
});
|
||||||
|
|||||||
@ -55,11 +55,11 @@ class AuthController extends BaseController
|
|||||||
return view('auth/login', $this->_viewDatas);
|
return view('auth/login', $this->_viewDatas);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function signin(string $site)
|
public function signup(string $site)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//각 Adapter별 인층체크 후 Session에 인증정보 설정
|
//각 Adapter별 인층체크 후 Session에 인증정보 설정
|
||||||
$this->getAdapter($site)->signin($this->request->getVar());
|
$this->getAdapter($site)->signup($this->request->getVar());
|
||||||
$return_url = $this->_session->get(SESSION_NAMES['RETURN_URL']) ?: "/";
|
$return_url = $this->_session->get(SESSION_NAMES['RETURN_URL']) ?: "/";
|
||||||
return redirect()->to($this->request->getVar(SESSION_NAMES['RETURN_URL']) ?: $return_url);
|
return redirect()->to($this->request->getVar(SESSION_NAMES['RETURN_URL']) ?: $return_url);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
@ -4,8 +4,9 @@ namespace App\Controllers\CLI\HPILO;
|
|||||||
|
|
||||||
use App\Models\HPILOModel;
|
use App\Models\HPILOModel;
|
||||||
use App\Entities\HPILOEntity;
|
use App\Entities\HPILOEntity;
|
||||||
|
use App\Libraries\API\HPILO\HPILO4;
|
||||||
|
|
||||||
class HPILO4
|
class HPILO
|
||||||
{
|
{
|
||||||
private $_adapter = null;
|
private $_adapter = null;
|
||||||
private function getAdapter(HPILOEntity $entity)
|
private function getAdapter(HPILOEntity $entity)
|
||||||
@ -25,8 +26,8 @@ class HPILO4
|
|||||||
//transation처리
|
//transation처리
|
||||||
// $this->getAuthModel()->db->transBegin();
|
// $this->getAuthModel()->db->transBegin();
|
||||||
foreach ($entitys as $entity) {
|
foreach ($entitys as $entity) {
|
||||||
$ilo = new \App\Libraries\HPILO\HPILO4($this->getAdapter($entity));
|
$ilo = new HPILO4($this->getAdapter($entity));
|
||||||
$entity = $ilo->refresh($entity);
|
$entity = $ilo->reload($entity);
|
||||||
if ($entity->hasChanged()) {
|
if ($entity->hasChanged()) {
|
||||||
if (!$model->save($entity)) {
|
if (!$model->save($entity)) {
|
||||||
log_message("error", __FUNCTION__ . "에서 호출:" . $model->getLastQuery());
|
log_message("error", __FUNCTION__ . "에서 호출:" . $model->getLastQuery());
|
||||||
@ -28,7 +28,7 @@ abstract class Adapter
|
|||||||
return ucfirst($this->_site);
|
return ucfirst($this->_site);
|
||||||
}
|
}
|
||||||
abstract public function getAuthButton();
|
abstract public function getAuthButton();
|
||||||
abstract public function signin(array $formDatas): UserEntity;
|
abstract public function signup(array $formDatas): UserEntity;
|
||||||
|
|
||||||
final protected function getUserModel(): UserModel
|
final protected function getUserModel(): UserModel
|
||||||
{
|
{
|
||||||
@ -46,7 +46,7 @@ abstract class Adapter
|
|||||||
return $this->_userSNSModel;
|
return $this->_userSNSModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function signin_process(UserEntity $entity): void
|
protected function signup_process(UserEntity $entity): void
|
||||||
{
|
{
|
||||||
$this->_session->set(SESSION_NAMES['ISLOGIN'], true);
|
$this->_session->set(SESSION_NAMES['ISLOGIN'], true);
|
||||||
$auths = [];
|
$auths = [];
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class GoogleAdapter extends Adapter
|
|||||||
return $button;
|
return $button;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function signin(array $formDatas): UserEntity
|
public function signup(array $formDatas): UserEntity
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Google 접근 권한 설정.
|
//Google 접근 권한 설정.
|
||||||
@ -122,7 +122,7 @@ class GoogleAdapter extends Adapter
|
|||||||
}
|
}
|
||||||
//인증된 사용자 정보를 가져온후 로그인처리
|
//인증된 사용자 정보를 가져온후 로그인처리
|
||||||
$entity = $this->getUserModel()->getEntity($snsEntity->user_id);
|
$entity = $this->getUserModel()->getEntity($snsEntity->user_id);
|
||||||
$this->signin_process($entity);
|
$this->signup_process($entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
throw new \Exception("관리자에게 문의하시기 바랍니다.<BR>{$e->getMessage()}");
|
throw new \Exception("관리자에게 문의하시기 바랍니다.<BR>{$e->getMessage()}");
|
||||||
|
|||||||
@ -16,7 +16,7 @@ class LocalAdapter extends Adapter
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
public function signin(array $formDatas): UserEntity
|
public function signup(array $formDatas): UserEntity
|
||||||
{
|
{
|
||||||
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 나 암호의 값이 없습니다.");
|
||||||
@ -26,7 +26,7 @@ class LocalAdapter extends Adapter
|
|||||||
throw new \Exception("암호가 맞지않습니다.");
|
throw new \Exception("암호가 맞지않습니다.");
|
||||||
}
|
}
|
||||||
//Session에 인증정보 설정
|
//Session에 인증정보 설정
|
||||||
$this->signin_process($entity);
|
$this->signup_process($entity);
|
||||||
return $entity;
|
return $entity;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user