lib/TWiki/Configure/UIs/PasswordProtected.pm
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 #
       
     2 # TWiki Enterprise Collaboration Platform, http://TWiki.org/
       
     3 #
       
     4 # Copyright (C) 2000-2006 TWiki Contributors.
       
     5 #
       
     6 # This program is free software; you can redistribute it and/or
       
     7 # modify it under the terms of the GNU General Public License
       
     8 # as published by the Free Software Foundation; either version 2
       
     9 # of the License, or (at your option) any later version. For
       
    10 # more details read LICENSE in the root of this distribution.
       
    11 #
       
    12 # This program is distributed in the hope that it will be useful,
       
    13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
       
    15 #
       
    16 # As per the GPL, removal of this notice is prohibited.
       
    17 #
       
    18 # Base class of password protected update UIs. It always saves the
       
    19 # base configuration (content of LocalSite.cfg) but also can
       
    20 #
       
    21 package TWiki::Configure::UIs::PasswordProtected;
       
    22 
       
    23 use strict;
       
    24 
       
    25 use TWiki::Configure::UI;
       
    26 
       
    27 use base 'TWiki::Configure::UI';
       
    28 
       
    29 use TWiki::Configure::Type;
       
    30 
       
    31 sub ui {
       
    32     my $this = shift;
       
    33     my $output = '';
       
    34 
       
    35     if( $TWiki::query->param( 'newCfgP' )) {
       
    36         if( $TWiki::query->param( 'newCfgP' ) eq
       
    37               $TWiki::query->param( 'confCfgP' )) {
       
    38             $this->{updates}{'{Password}'} =
       
    39               $this->_encode($TWiki::query->param( 'newCfgP' ));
       
    40             $output .= 'Password changed';
       
    41         } else {
       
    42             die 'New password and confirmation do not match';
       
    43         }
       
    44     }
       
    45 
       
    46     return $output . CGI::hr();
       
    47 }
       
    48 
       
    49 
       
    50 1;