Skip to content

Commit

Permalink
Merge pull request #4 from ctgraham/sprint-dev
Browse files Browse the repository at this point in the history
Sprint dev
  • Loading branch information
radekgomola authored Jun 16, 2022
2 parents 714cbf4 + 5f08ce0 commit 8720530
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion PlagiarismPlugin.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ function getEnabled($contextId = null) {
* @return array username and password, or null(s)
**/
function getForcedCredentials() {
$request = Application::getRequest();
$context = $request->getContext();
$contextPath = $context->getPath();
$username = Config::getVar('ithenticate', 'username[' . $contextPath . ']',
Config::getVar('ithenticate', 'username'));
$password = Config::getVar('ithenticate', 'password[' . $contextPath . ']',
Expand Down Expand Up @@ -88,7 +91,7 @@ public function callback($hookName, $args) {
$credentials = $this->getForcedCredentials();
$username = $credentials[0];
$password = $credentials[1];
if (!isset($username) || !isset($password)) {
if (empty($username) && empty($password)) {
$username = $this->getSetting($contextId, 'ithenticate_user');
$password = $this->getSetting($contextId, 'ithenticate_pass');
}
Expand Down
2 changes: 1 addition & 1 deletion PlagiarismSettingsForm.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function initData() {
$this->_data = array(
'ithenticate_user' => $this->_plugin->getSetting($this->_contextId, 'ithenticate_user'),
'ithenticate_pass' => $this->_plugin->getSetting($this->_contextId, 'ithenticate_pass'),
'ithenticate_forced' => isset($username) && isset($password)
'ithenticate_forced' => empty($username) || empty($password)
);
}

Expand Down

0 comments on commit 8720530

Please sign in to comment.