Skip to content

Commit

Permalink
Switch to email/password authentication
Browse files Browse the repository at this point in the history
  • Loading branch information
xendk committed Sep 25, 2024
1 parent 79023a7 commit 2ebec0c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
14 changes: 5 additions & 9 deletions inc/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
// AJAX form submission
$user = json_decode($_GET["user"]);

$name = $user->name;
$options = ['salt' => md5($config['salt_string'])];
$pass = password_hash($user->pass, PASSWORD_DEFAULT, $options);

/**
* TODO: The API usses post for this service, maybe use guzzle?
Expand All @@ -17,8 +14,7 @@
*/

$url = $config['harvester_url'] . $config['harvester_api_path'] . 'entries.json?group=user';
$token = '&token=' . $pass . '|' . $name;
$url = $url . $token;
$url = $url . "&email=" . $user->name . "&password=" . $user->pass;

// Get response header.
$header = get_headers($url);
Expand All @@ -28,14 +24,14 @@

// Check if response gives thumbs up and start session.
if ($code === 200) {
session_start();
$_SESSION['harvester_name'] = $name;
$_SESSION['harvester_pass'] = $pass;
session_start();
$_SESSION['harvester_name'] = $user->name;
$_SESSION['harvester_pass'] = $user->pass;
}

// Otherwise return response.
else {
return http_response_code($code);
return http_response_code($code);
}
}

Expand Down
4 changes: 1 addition & 3 deletions inc/feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
$name = $_SESSION['harvester_name'];
$pass = $_SESSION['harvester_pass'];

// Put together a token for url.
$token = '&token=' . $pass . '|' . $name;
$url = $url . $token;
$url = $url . "&email=" . $name . "&password=" . $pass;
}

// Wrap response.
Expand Down

0 comments on commit 2ebec0c

Please sign in to comment.