Automation init...3

This commit is contained in:
최준흠 2024-09-13 18:38:56 +09:00
parent db6916451b
commit 3e2ff5b6c0

View File

@ -29,25 +29,25 @@ class UserLibrary extends WebLibrary
// 로그인 메서드 // 로그인 메서드
public function login(string $host, string $id, string $password): bool|UserEntity public function login(string $host, string $id, string $password): bool|UserEntity
{ {
$response = $this->getWebLibrary($host)->getResponse( $entity = $this->getUserModel()->getEntityByID($id);
$host . getenv("mangboard.login.url"), // $response = $this->getWebLibrary($host)->getResponse(
"post", // $host . getenv("mangboard.login.url"),
[ // "post",
'form_params' => [ // [
'user_id' => $id, // 'form_params' => [
'password' => $password, // 'user_id' => $id,
], // 'password' => $password,
] // ],
); // ]
if ($response->getStatusCode() == 200) { // );
// $entity = $this->getUserModel()->getEntityByLoginCheck($id, $password); // if ($response->getStatusCode() == 200) {
$entity = $this->getUserModel()->getEntityByID($id); // $entity = $this->getUserModel()->getEntityByLoginCheck($id, $password);
if ($entity === null) { // if ($entity === null) {
throw new \Exception("{$id}는 회원이 아니거나 암호가 맞지 않습니다."); // throw new \Exception("{$id}는 회원이 아니거나 암호가 맞지 않습니다.");
} // }
} else { // } else {
throw new \Exception("연결실패:" . $response->getStatusCode()); // throw new \Exception("연결실패:" . $response->getStatusCode());
} // }
log_message("notice", "{$id}로 로그인 성공"); log_message("notice", "{$id}로 로그인 성공");
return $entity; return $entity;
} }