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/ApacheHtpasswdUser.pm

    r12236 r13796  
    121121    my $path = $Foswiki::cfg{Htpasswd}{FileName}; 
    122122 
    123     #TODO: what if the data dir is also read only? 
    124     if ( ( !-e $path ) || ( -e $path && -r $path && !-d $path && -w $path ) ) { 
    125         $this->{session}->enterContext('passwords_modifyable'); 
    126         return 0; 
    127     } 
     123    # We expect the path to exist and be writable. 
     124    return 0 if ( -e $path && -f $path && -w $path ); 
     125 
     126    # Otherwise, log a problem. 
     127    $this->{session}->logger->log( 
     128        'warning', 
     129        'The password file does not exist or cannot be written.' . 
     130        'Run =configure= and check the setting of {Htpasswd}{FileName}.' . 
     131        ' New user registration has been disabled until this is corrected.'); 
     132    # And disable registration (and password changes) 
     133    $Foswiki::cfg{Register}{EnableNewUserRegistration} = 0; 
    128134    return 1; 
    129135} 
Note: See TracChangeset for help on using the changeset viewer.