diff --git a/html/cgi-bin/chpasswd.cgi b/html/cgi-bin/chpasswd.cgi index 0a66062..00494f2 100644 --- a/html/cgi-bin/chpasswd.cgi +++ b/html/cgi-bin/chpasswd.cgi @@ -19,15 +19,26 @@ # # ############################################################################### +use strict; + +#usable only the following on debugging purpose +#use warnings; +#use CGI::Carp 'fatalsToBrowser'; + use CGI qw(param); use Apache::Htpasswd; use Crypt::PasswdMD5; -$swroot = "/var/ipfire"; - my %cgiparams; my %mainsettings; my %proxysettings; +my %netsettings; +my %temp; +my $swroot; +my $errormessage; +my $language; + +$swroot = "/var/ipfire"; $proxysettings{'NCSA_MIN_PASS_LEN'} = 6; @@ -38,12 +49,10 @@ $language = $mainsettings{'LANGUAGE'}; ### Initialize language if ($language =~ /^(\w+)$/) {$language = $1;} - # - # Uncomment this to force a certain language: - # $language='en'; - # -require "${swroot}/langs/en.pl"; -require "${swroot}/langs/${language}.pl"; + +require '/var/ipfire/general-functions.pl'; +require "${General::swroot}/lang.pl"; +require "${General::swroot}/header.pl"; my $userdb = "$swroot/proxy/advanced/ncsa/passwd"; @@ -53,26 +62,26 @@ my $success = 0; &getcgihash(\%cgiparams); -if ($cgiparams{'SUBMIT'} eq $tr{'advproxy chgwebpwd change password'}) +if ($cgiparams{'SUBMIT'} eq $Lang::tr{'advproxy chgwebpwd change password'}) { if ($cgiparams{'USERNAME'} eq '') { - $errormessage = $tr{'advproxy errmsg no username'}; + $errormessage = $Lang::tr{'advproxy errmsg no username'}; goto ERROR; } if (($cgiparams{'OLD_PASSWORD'} eq '') || ($cgiparams{'NEW_PASSWORD_1'} eq '') || ($cgiparams{'NEW_PASSWORD_2'} eq '')) { - $errormessage = $tr{'advproxy errmsg no password'}; + $errormessage = $Lang::tr{'advproxy errmsg no password'}; goto ERROR; } if (!($cgiparams{'NEW_PASSWORD_1'} eq $cgiparams{'NEW_PASSWORD_2'})) { - $errormessage = $tr{'advproxy errmsg passwords different'}; + $errormessage = $Lang::tr{'advproxy errmsg passwords different'}; goto ERROR; } if (length($cgiparams{'NEW_PASSWORD_1'}) < $proxysettings{'NCSA_MIN_PASS_LEN'}) { - $errormessage = $tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$tr{'advproxy errmsg password length 2'}; + $errormessage = $Lang::tr{'advproxy errmsg password length 1'}.$proxysettings{'NCSA_MIN_PASS_LEN'}.$Lang::tr{'advproxy errmsg password length 2'}; goto ERROR; } @@ -81,14 +90,14 @@ if ($cgiparams{'SUBMIT'} eq $tr{'advproxy chgwebpwd change password'}) # Check if a user with this name exists my $old_password = $htpasswd->fetchPass($cgiparams{'USERNAME'}); if (!$old_password) { - $errormessage = $tr{'advproxy errmsg invalid user'}; + $errormessage = $Lang::tr{'advproxy errmsg invalid user'}; goto ERROR; } # Reset password if (!$htpasswd->htpasswd($cgiparams{'USERNAME'}, $cgiparams{'NEW_PASSWORD_1'}, $cgiparams{'OLD_PASSWORD'})) { - $errormessage = $tr{'advproxy errmsg password incorrect'}; + $errormessage = $Lang::tr{'advproxy errmsg password incorrect'}; goto ERROR; } @@ -103,7 +112,7 @@ print "Cache-control: no-cache\n"; print "Connection: close\n"; print "Content-type: text/html\n\n"; -print < @@ -124,7 +133,7 @@ print < - $tr{'advproxy chgwebpwd change web password'} + $Lang::tr{'advproxy chgwebpwd change web password'} @@ -134,7 +143,7 @@ print < - $tr{'advproxy chgwebpwd username'}: + $Lang::tr{'advproxy chgwebpwd username'}: @@ -142,7 +151,7 @@ print < - $tr{'advproxy chgwebpwd old password'}: + $Lang::tr{'advproxy chgwebpwd old password'}: @@ -150,7 +159,7 @@ print < - $tr{'advproxy chgwebpwd new password'}: + $Lang::tr{'advproxy chgwebpwd new password'}: @@ -158,7 +167,7 @@ print < - $tr{'advproxy chgwebpwd new password confirm'}: + $Lang::tr{'advproxy chgwebpwd new password confirm'}: @@ -166,7 +175,7 @@ print < - +


@@ -180,7 +189,7 @@ if ($errormessage) - $tr{'advproxy chgwebpwd ERROR'} $errormessage + $Lang::tr{'advproxy chgwebpwd ERROR'} $errormessage @@ -194,7 +203,7 @@ if ($success) - $tr{'advproxy chgwebpwd SUCCESS'} $tr{'advproxy errmsg change success'} + $Lang::tr{'advproxy chgwebpwd SUCCESS'} $Lang::tr{'advproxy errmsg change success'}