diff --git a/sso/Forum.php b/sso/Forum.php index 43f10b5..5b7a8e4 100644 --- a/sso/Forum.php +++ b/sso/Forum.php @@ -1,5 +1,7 @@ createPassword($username); $token = $this->getToken($username, $password); if (empty($token)) { - $this->signup($username, $password, $email); + $this->signup($username, $password, $email, $avatarUrl); $token = $this->getToken($username, $password); } @@ -65,7 +67,7 @@ class Forum return isset($response['token']) ? $response['token'] : ''; } - private function signup($username, $password, $email) + private function signup($username, $password, $email, $avatarUrl) { $data = [ "data" => [ @@ -74,7 +76,7 @@ class Forum "username" => $username, "password" => $password, "email" => $email, - "avatarUrl" => "https://cyantificdsgn.files.wordpress.com/2009/11/spidey.png" + "avatarUrl" => $avatarUrl ] ] ]; diff --git a/sso/auth.php b/sso/auth.php index 2026c50..cf929a9 100644 --- a/sso/auth.php +++ b/sso/auth.php @@ -1,16 +1,9 @@ [ - 'password' => 'password', - 'email' => 'test@mailinator.com', - ], -]; +$auth_token = $_GET['auth_token']; -$username = empty($_POST['username']) ? '' : $_POST['username']; -$password = empty($_POST['password']) ? '' : $_POST['password']; if (isset($users[$username]) && $users[$username]['password'] === $password) { $email = $users[$username]['email']; diff --git a/sso/index.php b/sso/index.php index 28d5cf3..e9e61a5 100644 --- a/sso/index.php +++ b/sso/index.php @@ -1,7 +1,58 @@ -
A user is logged into members area. Let's demonstrate SSO with Flarum.
+href="/auth.php?auth_token=test"+