mirror of
https://github.com/grocy/grocy.git
synced 2026-03-27 23:29:25 +01:00
Added a new config.php setting DISABLE_AUTH to be able to disable authentication / the login screen (closes #246)
This commit is contained in:
parent
8c205941c7
commit
09b23847b5
9
app.php
9
app.php
|
|
@ -40,6 +40,15 @@ require_once __DIR__ . '/vendor/autoload.php';
|
|||
require_once GROCY_DATAPATH . '/config.php';
|
||||
require_once __DIR__ . '/config-dist.php'; //For not in own config defined values we use the default ones
|
||||
|
||||
// Definitions for disabled authentication mode
|
||||
if (GROCY_DISABLE_AUTH === true)
|
||||
{
|
||||
if (!defined('GROCY_USER_ID'))
|
||||
{
|
||||
define('GROCY_USER_ID', 1);
|
||||
}
|
||||
}
|
||||
|
||||
// Setup base application
|
||||
$appContainer = new \Slim\Container([
|
||||
'settings' => [
|
||||
|
|
|
|||
|
|
@ -9,3 +9,4 @@
|
|||
- Items can now be switched between lists (there is a shopping list dropdown on the item edit page)
|
||||
- Items can now be marked as "done" (new check mark button per item, when clicked, the item will be displayed greyed out, when clicked again the item will be displayed normally again)
|
||||
- Improved that products can now also be consumed as spoiled from the stock overview page (option in the more/context menu per line)
|
||||
- Added a new `config.php` setting `DISABLE_AUTH` to be able to disable authentication / the login screen
|
||||
|
|
|
|||
|
|
@ -41,6 +41,10 @@ Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin');
|
|||
# set this to true
|
||||
Setting('DISABLE_URL_REWRITING', false);
|
||||
|
||||
# Set this to true if you want to disable authentication / the login screen,
|
||||
# places where user context is needed will then use the default (first existing) user
|
||||
Setting('DISABLE_AUTH', false);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ class ApiKeyAuthMiddleware extends BaseMiddleware
|
|||
$route = $request->getAttribute('route');
|
||||
$routeName = $route->getName();
|
||||
|
||||
if (GROCY_IS_DEMO_INSTALL || GROCY_IS_EMBEDDED_INSTALL)
|
||||
if (GROCY_IS_DEMO_INSTALL || GROCY_IS_EMBEDDED_INSTALL || GROCY_DISABLE_AUTH)
|
||||
{
|
||||
define('GROCY_AUTHENTICATED', true);
|
||||
$response = $next($request, $response);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ class SessionAuthMiddleware extends BaseMiddleware
|
|||
{
|
||||
$response = $next($request, $response);
|
||||
}
|
||||
elseif (GROCY_IS_DEMO_INSTALL || GROCY_IS_EMBEDDED_INSTALL)
|
||||
elseif (GROCY_IS_DEMO_INSTALL || GROCY_IS_EMBEDDED_INSTALL || GROCY_DISABLE_AUTH)
|
||||
{
|
||||
$user = $sessionService->GetDefaultUser();
|
||||
define('GROCY_AUTHENTICATED', true);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user