Skip to content

Commit

Permalink
Use custom header
Browse files Browse the repository at this point in the history
PHP used in CGI mode will eat the Authorization header and thus the authentication never worked.

Fixes #263
  • Loading branch information
LukasReschke committed Mar 5, 2016
1 parent 412a28a commit 9a7bfc4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pub/js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var loginToken;
$.ajax({
url: '.',
headers: {
'Authorization': loginToken,
'X-Updater-Auth': loginToken,
},
method: 'POST',
success: function(data){
Expand Down
2 changes: 1 addition & 1 deletion pub/js/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
$(function () {
// Pass the auth token with any request
$.ajaxSetup({
headers: {'Authorization': loginToken}
headers: {'X-Updater-Auth': loginToken}
});


Expand Down
2 changes: 1 addition & 1 deletion src/Controller/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected function isLoggedIn() {
if(is_null($storedSecret)) {
die('updater.secret is undefined in config/config.php. Either browse the admin settings in your ownCloud and click "Open updater" or define a strong secret using <pre>php -r \'echo password_hash("MyStrongSecretDoUseYourOwn!", PASSWORD_DEFAULT)."\n";\'</pre> and set this in the config.php.');
}
$sentAuthHeader = ($this->request->header('Authorization') !== null) ? $this->request->header('Authorization') : '';
$sentAuthHeader = ($this->request->header('X_Updater_Auth') !== null) ? $this->request->header('X_Updater_Auth') : '';

if(password_verify($sentAuthHeader, $storedSecret)) {
return true;
Expand Down

0 comments on commit 9a7bfc4

Please sign in to comment.