possible fix for basic auth
This commit is contained in:
parent
e0064504e7
commit
cdafbab7b1
2 changed files with 23 additions and 17 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -24,3 +24,4 @@ yarn-error.log
|
||||||
.TemporaryItems
|
.TemporaryItems
|
||||||
.Trashes
|
.Trashes
|
||||||
.VolumeIcon.icns
|
.VolumeIcon.icns
|
||||||
|
storage/app/public/avatars/*
|
||||||
|
|
|
@ -66,6 +66,26 @@ class AppServiceProvider extends ServiceProvider
|
||||||
$view->with('alt_bg', $alt_bg );
|
$view->with('alt_bg', $alt_bg );
|
||||||
$view->with('allusers', $allusers );
|
$view->with('allusers', $allusers );
|
||||||
$view->with('current_user', $current_user );
|
$view->with('current_user', $current_user );
|
||||||
|
|
||||||
|
if(isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION'])) {
|
||||||
|
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
|
||||||
|
explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
|
||||||
|
}
|
||||||
|
if(!\Auth::check()) {
|
||||||
|
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
||||||
|
$credentials = ['username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']];
|
||||||
|
|
||||||
|
if (\Auth::attempt($credentials)) {
|
||||||
|
// Authentication passed...
|
||||||
|
$user = \Auth::user();
|
||||||
|
\Session::put('current_user', $user);
|
||||||
|
//session(['current_user' => $user]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
@ -76,21 +96,6 @@ class AppServiceProvider extends ServiceProvider
|
||||||
if(env('APP_URL') != 'http://localhost') {
|
if(env('APP_URL') != 'http://localhost') {
|
||||||
\URL::forceRootUrl(env('APP_URL'));
|
\URL::forceRootUrl(env('APP_URL'));
|
||||||
}
|
}
|
||||||
if(isset($_SERVER['HTTP_AUTHORIZATION']) && !empty($_SERVER['HTTP_AUTHORIZATION'])) {
|
|
||||||
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) =
|
|
||||||
explode(':', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
|
|
||||||
}
|
|
||||||
if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
|
|
||||||
$credentials = ['username' => $_SERVER['PHP_AUTH_USER'], 'password' => $_SERVER['PHP_AUTH_PW']];
|
|
||||||
|
|
||||||
if (\Auth::attempt($credentials)) {
|
|
||||||
// Authentication passed...
|
|
||||||
$user = \Auth::user();
|
|
||||||
\Session::put('current_user', $user);
|
|
||||||
//session(['current_user' => $user]);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue