Skip to content

Commit

Permalink
Check to see if orcid credentials are provided before requesting acce…
Browse files Browse the repository at this point in the history
…ss token.
  • Loading branch information
brooks1man committed Feb 15, 2023
1 parent 4794131 commit a48be90
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions includes/submit_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ function get_creators($creatorHeaders, $row) {
// If ORCID header exists process that instead of creator{n}.
if(!empty($row['orcid'])) {
if(!file_exists($tokenFile)) {
// Can we write to the config folder?
if(!is_writable('config')) {
array_push($_SESSION['output'], 'The config directory is not writable.');
return $creators;
Expand Down Expand Up @@ -295,6 +296,12 @@ function get_orcid_token() {
'scope' => '/read-public'
];

// Are ORCID credentials configured?
if(empty(CONFIG['orcidClientId']) || empty(CONFIG['orcidSecret'])) {
array_push($_SESSION['output'], 'ORCID credentials are not configured.');
return null;
}

if(CONFIG['devMode']) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
}
Expand Down

0 comments on commit a48be90

Please sign in to comment.