Changeset 8408
- Timestamp:
- 08/03/10 02:56:39 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x00/core/lib/Foswiki/Users/ApacheHtpasswdUser.pm
r2689 r8408 1 1 # See bottom of file for license and copyright information 2 2 package Foswiki::Users::ApacheHtpasswdUser; 3 use base 'Foswiki::Users::Password'; 4 5 use Apache::Htpasswd; 3 use strict; 4 use warnings; 5 6 use Foswiki::Users::Password (); 7 our @ISA = ('Foswiki::Users::Password'); 8 9 use Apache::Htpasswd (); 6 10 use Assert; 7 use strict;8 use Foswiki::Users::Password;9 11 use Error qw( :try ); 10 12 … … 28 30 29 31 my $this = $class->SUPER::new($session); 30 $this->{apache} = 31 new Apache::Htpasswd( { passwdFile => $Foswiki::cfg{Htpasswd}{FileName} } ); 32 $this->{apache} = new Apache::Htpasswd( 33 { passwdFile => $Foswiki::cfg{Htpasswd}{FileName} } ); 34 unless ( -e $Foswiki::cfg{Htpasswd}{FileName} ) { 35 # apache doesn't create the file, so need to init it 36 my $F; 37 open( $F, '>', $Foswiki::cfg{Htpasswd}{FileName} ) || die $!; 38 print $F ""; 39 close($F); 40 } 32 41 33 42 return $this; … … 125 134 ASSERT($login) if DEBUG; 126 135 127 if ( defined($oldPassU) ) {136 if ( defined($oldPassU) && $oldPassU ne '1') { 128 137 my $ok = 0; 129 138 try { … … 139 148 my $added = 0; 140 149 try { 141 $added = $this->{apache}->htpasswd( $login, $newPassU, $oldPassU ); 150 if ( defined($oldPassU) && $oldPassU eq '1') { 151 $added = $this->{apache}->htpasswd( $login, $newPassU, { 'overwrite' => 1} ); 152 } else { 153 $added = $this->{apache}->htpasswd( $login, $newPassU, $oldPassU ); 154 } 142 155 $this->{error} = undef; 143 156 } … … 191 204 192 205 1; 193 __ DATA__194 # Module ofFoswiki - The Free and Open Source Wiki, http://foswiki.org/195 # 196 # Copyright (C) 2008-2009 Foswiki Contributors. All Rights Reserved. 197 # Foswiki Contributors are listed in the AUTHORS file in the root 198 # of this distribution.NOTE: Please extend that file, not this notice.199 # 200 #Additional copyrights apply to some or all of the code in this201 #file as follows:202 # 203 #Copyright (C) 2004-2007 TWiki Contributors. All Rights Reserved.204 #TWiki Contributors are listed in the AUTHORS file in the root205 # of this distribution. NOTE: Please extend that file, not this notice.206 # 207 #This program is free software; you can redistribute it and/or208 #modify it under the terms of the GNU General Public License209 #as published by the Free Software Foundation; either version 2210 #of the License, or (at your option) any later version. For211 #more details read LICENSE in the root of this distribution.212 # 213 #This program is distributed in the hope that it will be useful,214 #but WITHOUT ANY WARRANTY; without even the implied warranty of215 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.216 # 217 #As per the GPL, removal of this notice is prohibited.206 __END__ 207 Foswiki - The Free and Open Source Wiki, http://foswiki.org/ 208 209 Copyright (C) 2008-2010 Foswiki Contributors. Foswiki Contributors 210 are listed in the AUTHORS file in the root of this distribution. 211 NOTE: Please extend that file, not this notice. 212 213 Additional copyrights apply to some or all of the code in this 214 file as follows: 215 216 Copyright (C) 2004-2007 TWiki Contributors. All Rights Reserved. 217 TWiki Contributors are listed in the AUTHORS file in the root 218 of this distribution. 219 220 This program is free software; you can redistribute it and/or 221 modify it under the terms of the GNU General Public License 222 as published by the Free Software Foundation; either version 2 223 of the License, or (at your option) any later version. For 224 more details read LICENSE in the root of this distribution. 225 226 This program is distributed in the hope that it will be useful, 227 but WITHOUT ANY WARRANTY; without even the implied warranty of 228 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 229 230 As per the GPL, removal of this notice is prohibited.
Note: See TracChangeset
for help on using the changeset viewer.
