diff options
-rw-r--r-- | etc/inc/auth.inc | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index a13b815..c221010 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -61,8 +61,20 @@ function passwd_backed_basic_auth() { /* Check to see if user even exists */ $username = $HTTP_SERVER_VARS['AUTH_USER']; - if(!($line = array_shift(preg_grep("/^$username:.*$/", $authfile)))) - continue; + + /* + * auth the username + * honour custom username set in webConfigurator page */ + */ + if($config['system']['username'] == $HTTP_SERVER_VARS['AUTH_USER']) { + /* we match, don't continue to next for loop */ + } else { + /* finally, if we're here then we didn't match the username in + * the webConfigurator. Check the password file. + */ + if(!($line = array_shift(preg_grep("/^$username:.*$/", $authfile)))) + continue; + } /* Get crypted password */ preg_match("/^$username:((\\$1\\$[.\d\w_\/]{8}\\$)[.\d\w_\/]{22})$/", $line, $matches); |