Ignore:
Timestamp:
01/23/12 19:00:19 (4 months ago)
Author:
CrawfordCurrie
Message:

Item11458: simplify and streamline handling of password file; it now must exist for Foswiki to run, and will be created by =configure= if not. This lets us do enhanced checking in =configure= while reducing the runtime burden.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/core/lib/Foswiki/Users/HtPasswdUser.pm

    r13756 r13796  
    162162    my $path = $Foswiki::cfg{Htpasswd}{FileName}; 
    163163 
    164     #TODO: what if the data dir is also read only? 
    165     if ( ( !-e $path ) || ( -e $path && -r $path && !-d $path && -w $path ) ) { 
    166         $this->{session}->enterContext('passwords_modifyable'); 
    167         return 0; 
    168     } 
     164    # We expect the path to exist and be writable. 
     165    return 0 if ( -e $path && -f $path && -w $path ); 
     166 
     167    # Otherwise, log a problem. 
     168    $this->{session}->logger->log( 
     169        'warning', 
     170        'The password file does not exist or cannot be written.' . 
     171        'Run =configure= and check the setting of {Htpasswd}{FileName}.' . 
     172        ' New user registration has been disabled until this is corrected.'); 
     173    # And disable registration (which will also disable password changes) 
     174    $Foswiki::cfg{Register}{EnableNewUserRegistration} = 0; 
     175 
    169176    return 1; 
    170177} 
Note: See TracChangeset for help on using the changeset viewer.