This commit is contained in:
Elizabeth Cray 2022-05-08 00:15:19 +00:00
parent 00d5256f43
commit 49f3d28ae9
3 changed files with 7 additions and 9 deletions

View File

@ -58,15 +58,11 @@ if (isset($_REQUEST["act"])){
curl_setopt($request, CURLOPT_POST, 1);
curl_setopt($request, CURLOPT_URL, "https://hackers.town/oauth/token");
curl_setopt($request, CURLOPT_RETURNTRANSFER, 1);
// $reqirectUri = "urn:ietf:wg:oauth:2.0:oob";
$reqirectUri = "https://tty.hackers.town/auth";
$options = "grant_type=authorization_code&code=".$MastCode."&client_id=".$config->oauth->key."&client_secret=".$config->oauth->secret."&scope=read:accounts&redirect_uri=".$reqirectUri;
curl_setopt($request, CURLOPT_POSTFIELDS, $options);
// echo $options;
// echo json_encode($request);
$response = curl_exec($request);
curl_close($request);
// echo $response;
$Auth = json_decode($response);
if(isset($Auth->token_type)){
// Valid Auth?
@ -161,7 +157,6 @@ if (isset($_REQUEST["act"])){
</form>
</div>
<div class="row copyright">
<!-- TODO: Make this file PHP and make the canary dependent on /etc/ttyserver/canary -->
<?php
if (file_exists("/etc/ttyserver/canary")){
echo "Canary";

View File

@ -1,4 +1,4 @@
const DEBUG = true;
const DEBUG = false;
var isMobile = false;
const dbp = (msg) => {
@ -173,7 +173,7 @@ const beginOauth = () => {
$.ajax({
url: "https://tty.hackers.town/auth?act=id"
}).then((data) => {
dbd(table);
dbd(data);
if(data.id){
var redirect = "https://hackers.town/oauth/authorize?"+
"response_type=code&client_id="+data.id+"&redirect_uri="+

View File

@ -32,8 +32,11 @@
<button id="bttn" class="keyButton" onclick="beginOauth()">Create Account</button>
</div>
<div class="row copyright">
<!-- TODO: Make this file PHP and make the canary dependent on /etc/ttyserver/canary -->
Canary
<?php
if (file_exists("/etc/ttyserver/canary")){
echo "Canary";
}
?>
<br>
Copyright ©️ 2022 Elizabeth Anne Cray
</div>