Skip to content

Commit

Permalink
Fix compatibility with twofactor
Browse files Browse the repository at this point in the history
Conflicts:
	htdocs/api/class/api_login.class.php
	htdocs/dav/fileserver.php
  • Loading branch information
eldy committed Aug 22, 2019
1 parent 9bd229b commit a19228c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions htdocs/api/class/api_login.class.php
Expand Up @@ -63,6 +63,8 @@ public function index($login, $password, $entity = '', $reset = 0)
// Authentication mode
if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication = 'http,dolibarr';
$dolibarr_main_authentication = preg_replace('/twofactor/', 'dolibarr', $dolibarr_main_authentication);

// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser')
{
Expand Down
13 changes: 13 additions & 0 deletions htdocs/dav/fileserver.php
Expand Up @@ -81,6 +81,19 @@
// Authentication mode
if (empty($dolibarr_main_authentication))
$dolibarr_main_authentication='http,dolibarr';
$dolibarr_main_authentication = preg_replace('/twofactor/', 'dolibarr', $dolibarr_main_authentication);

// Authentication mode: forceuser
if ($dolibarr_main_authentication == 'forceuser')
{
if (empty($dolibarr_auto_user)) $dolibarr_auto_user='auto';
if ($dolibarr_auto_user != $username)
{
dol_syslog("Warning: your instance is set to use the automatic forced login '".$dolibarr_auto_user."' that is not the requested login. DAV usage is forbidden in this mode.");
return false;
}
}

$authmode = explode(',', $dolibarr_main_authentication);
$entity = (GETPOST('entity', 'int') ? GETPOST('entity', 'int') : (!empty($conf->entity) ? $conf->entity : 1));

Expand Down

0 comments on commit a19228c

Please sign in to comment.