12345678910111213141516171819202122 |
- <?php
- class LoginAction implements IAction {
- public function execute() {
- $username = isset($_POST['username']) ? $_POST['username'] : "";
- $password = isset($_POST['password']) ? $_POST['password'] : "";
-
- if(!isset($username) || !isset($password) || empty($username) || empty($password))
- {
- return array("error" => "Username or password is required.");
- }
- $authData = $this->domainLogin($username, $password);
- if($authData) {
- return $authData;
- }
- return array("error" => "Username or password is invalid.");
- }
- private function domainLogin($username, $password) {
- return (new Authorize())->login($username, $password);
- }
- }
|