33 lines
803 B
PHP
33 lines
803 B
PHP
<?php
|
|
|
|
namespace App\Libraries\Adapter\Auth;
|
|
|
|
use App\Entities\UserEntity;
|
|
|
|
class LocalAdapter extends Adapter
|
|
{
|
|
public function __construct(string $site, $debug = false)
|
|
{
|
|
parent::__construct($site, $debug);
|
|
}
|
|
|
|
public function getAuthButton()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public function signup(array $formDatas): UserEntity
|
|
{
|
|
if (!isset($formDatas['id']) || !$formDatas['id'] || !isset($formDatas['passwd']) || !$formDatas['passwd']) {
|
|
throw new \Exception("ID 나 암호의 값이 없습니다.");
|
|
}
|
|
$entity = $this->getUserModel()->getEntity(['id' => $formDatas['id']]);
|
|
if (!password_verify($formDatas['passwd'], $entity->passwd)) {
|
|
throw new \Exception("암호가 맞지않습니다.");
|
|
}
|
|
//Session에 인증정보 설정
|
|
$this->signup_process($entity);
|
|
return $entity;
|
|
}
|
|
}
|