version 1.168, 2012/08/27 00:53:22
|
version 1.169, 2012/08/27 06:28:05
|
Line 1054 sub print_login {
|
Line 1054 sub print_login {
|
$datatable .= '<input type="file" name="loginhelpurl_add_file" />'; |
$datatable .= '<input type="file" name="loginhelpurl_add_file" />'; |
} |
} |
$datatable .= '</td></tr>'; |
$datatable .= '</td></tr>'; |
|
$itemcount ++; |
} |
} |
|
$datatable .= &captcha_choice('login',$settings,$itemcount); |
} |
} |
return $datatable; |
return $datatable; |
} |
} |
Line 3299 sub print_usercreation {
|
Line 3301 sub print_usercreation {
|
$dom,$numinrow,$othertitle, |
$dom,$numinrow,$othertitle, |
'statustocreate'); |
'statustocreate'); |
$$rowtotal ++; |
$$rowtotal ++; |
|
$rownum ++; |
} |
} |
} |
} |
$datatable .= &captcha_choice('cancreate',$createsettings); |
$datatable .= &captcha_choice('cancreate',$createsettings,$rownum); |
} else { |
} else { |
my @contexts = ('author','course','domain'); |
my @contexts = ('author','course','domain'); |
my @authtypes = ('int','krb4','krb5','loc'); |
my @authtypes = ('int','krb4','krb5','loc'); |
Line 3354 sub print_usercreation {
|
Line 3357 sub print_usercreation {
|
} |
} |
|
|
sub captcha_choice { |
sub captcha_choice { |
my ($context,$settings) = @_; |
my ($context,$settings,$itemcount) = @_; |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext); |
my ($keyentry,$currpub,$currpriv,%checked,$rowname,$pubtext,$privtext); |
my %lt = &captcha_phrases(); |
my %lt = &captcha_phrases(); |
$keyentry = 'hidden'; |
$keyentry = 'hidden'; |
if ($context eq 'cancreate') { |
if ($context eq 'cancreate') { |
$rowname = &mt('CAPTCHA validation (e-mail as username)'); |
$rowname = &mt('CAPTCHA validation (e-mail as username)'); |
} elsif ($context eq 'help') { |
} elsif ($context eq 'login') { |
$rowname = &mt('CAPTCHA validation'); |
$rowname = &mt('"Contact helpdesk" CAPTCHA validation'); |
} |
} |
if (ref($settings) eq 'HASH') { |
if (ref($settings) eq 'HASH') { |
if ($settings->{'captcha'}) { |
if ($settings->{'captcha'}) { |
Line 3381 sub captcha_choice {
|
Line 3384 sub captcha_choice {
|
} else { |
} else { |
$checked{'original'} = ' checked="checked"'; |
$checked{'original'} = ' checked="checked"'; |
} |
} |
my $output = '<tr class="LC_odd_row">'. |
my $css_class = $itemcount%2?' class="LC_odd_row"':''; |
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_right_item" colspan="2">'."\n". |
my $output = '<tr'.$css_class.'>'. |
|
'<td class="LC_left_item">'.$rowname.'</td><td class="LC_left_item" colspan="2">'."\n". |
'<table><tr><td>'."\n"; |
'<table><tr><td>'."\n"; |
foreach my $option ('original','recaptcha','notused') { |
foreach my $option ('original','recaptcha','notused') { |
$output .= '<span class="LC_nobreak"><label><input type="radio" name="'.$context.'_captcha" value="'. |
$output .= '<span class="LC_nobreak"><label><input type="radio" name="'.$context.'_captcha" value="'. |
Line 4613 sub modify_login {
|
Line 4617 sub modify_login {
|
$new = ''; |
$new = ''; |
} |
} |
} |
} |
|
|
$loginhash{login}{loginvia}{$lonhost}{$item} = $new; |
$loginhash{login}{loginvia}{$lonhost}{$item} = $new; |
} |
} |
} |
} |
Line 4724 sub modify_login {
|
Line 4727 sub modify_login {
|
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
$errors .= '<li><span class="LC_error">'.$error.'</span></li>'; |
} |
} |
} |
} |
|
&process_captcha('login',\%changes,$loginhash{'login'},$domconfig{'login'}); |
|
|
my $defaulthelpfile = '/adm/loginproblems.html'; |
my $defaulthelpfile = '/adm/loginproblems.html'; |
my $defaulttext = &mt('Default in use'); |
my $defaulttext = &mt('Default in use'); |
Line 4819 sub modify_login {
|
Line 4823 sub modify_login {
|
} |
} |
} |
} |
} |
} |
|
} elsif ($item eq 'captcha') { |
|
if (ref($loginhash{'login'}) eq 'HASH') { |
|
my $chgtxt; |
|
if ($loginhash{'login'}{$item} eq 'notused') { |
|
$chgtxt .= &mt('No CAPTCHA validation in use for helpdesk form.'); |
|
} else { |
|
my %captchas = &captcha_phrases(); |
|
if ($captchas{$loginhash{'login'}{$item}}) { |
|
$chgtxt .= &mt("Validation for helpdesk form set to $captchas{$loginhash{'login'}{$item}}."); |
|
} else { |
|
$chgtxt .= &mt('Validation for helpdesk form set to unknown type.'); |
|
} |
|
} |
|
$resulttext .= '<li>'.$chgtxt.'</li>'; |
|
} |
|
} elsif ($item eq 'recaptchakeys') { |
|
if (ref($loginhash{'login'}) eq 'HASH') { |
|
my ($privkey,$pubkey); |
|
if (ref($loginhash{'login'}{$item}) eq 'HASH') { |
|
$pubkey = $loginhash{'login'}{$item}{'public'}; |
|
$privkey = $loginhash{'login'}{$item}{'private'}; |
|
} |
|
my $chgtxt .= &mt('ReCAPTCHA keys changes').'<ul>'; |
|
if (!$pubkey) { |
|
$chgtxt .= '<li>'.&mt('Public key deleted').'</li>'; |
|
} else { |
|
$chgtxt .= '<li>'.&mt('Public key set to [_1]',$pubkey).'</li>'; |
|
} |
|
if (!$privkey) { |
|
$chgtxt .= '<li>'.&mt('Private key deleted').'</li>'; |
|
} else { |
|
$chgtxt .= '<li>'.&mt('Private key set to [_1]',$pubkey).'</li>'; |
|
} |
|
$chgtxt .= '</ul>'; |
|
$resulttext .= '<li>'.$chgtxt.'</li>'; |
|
} |
} else { |
} else { |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
$resulttext .= '<li>'.&mt("$title{$item} set to $offon[$env{'form.'.$item}]").'</li>'; |
} |
} |
Line 6911 sub process_captcha {
|
Line 6951 sub process_captcha {
|
$newsettings->{'captcha'} = 'original'; |
$newsettings->{'captcha'} = 'original'; |
} |
} |
if ($current->{'captcha'} ne $newsettings->{'captcha'}) { |
if ($current->{'captcha'} ne $newsettings->{'captcha'}) { |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
if ($container eq 'cancreate') { |
push(@{$changes->{'cancreate'}},'captcha'); |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
} elsif (!defined($changes->{'cancreate'})) { |
push(@{$changes->{'cancreate'}},'captcha'); |
$changes->{'cancreate'} = ['captcha']; |
} elsif (!defined($changes->{'cancreate'})) { |
|
$changes->{'cancreate'} = ['captcha']; |
|
} |
|
} else { |
|
$changes->{'captcha'} = 1; |
} |
} |
} |
} |
my ($newpub,$newpriv,$currpub,$currpriv); |
my ($newpub,$newpriv,$currpub,$currpriv); |
if ($newsettings->{'captcha'} eq 'recaptcha') { |
if ($newsettings->{'captcha'} eq 'recaptcha') { |
$newpub = $env{'form.'.$container.'_recaptchapub'}; |
$newpub = $env{'form.'.$container.'_recaptchapub'}; |
$newpriv = $env{'form.'.$container.'_recaptchapriv'}; |
$newpriv = $env{'form.'.$container.'_recaptchapriv'}; |
|
$newpub =~ s/\W//g; |
|
$newpriv =~ s/\W//g; |
|
$newsettings->{'recaptchakeys'} = { |
|
public => $newpub, |
|
private => $newpriv, |
|
}; |
} |
} |
$newsettings->{'recaptchakeys'} = { |
|
public => $newpub, |
|
private => $newpriv, |
|
}; |
|
if (ref($current->{'recaptchakeys'}) eq 'HASH') { |
if (ref($current->{'recaptchakeys'}) eq 'HASH') { |
$currpub = $current->{'recaptchakeys'}{'public'}; |
$currpub = $current->{'recaptchakeys'}{'public'}; |
$currpriv = $current->{'recaptchakeys'}{'private'}; |
$currpriv = $current->{'recaptchakeys'}{'private'}; |
|
$newsettings->{'recaptchakeys'} = { |
|
public => '', |
|
private => '', |
|
} |
} |
} |
if (($newpub ne $currpub) || ($newpriv ne $currpriv)) { |
if (($newpub ne $currpub) || ($newpriv ne $currpriv)) { |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
if ($container eq 'cancreate') { |
push(@{$changes->{'cancreate'}},'recaptchakeys'); |
if (ref($changes->{'cancreate'}) eq 'ARRAY') { |
} elsif (!defined($changes->{'cancreate'})) { |
push(@{$changes->{'cancreate'}},'recaptchakeys'); |
$changes->{'cancreate'} = ['recaptchakeys']; |
} elsif (!defined($changes->{'cancreate'})) { |
|
$changes->{'cancreate'} = ['recaptchakeys']; |
|
} |
|
} else { |
|
$changes->{'recaptchakeys'} = 1; |
} |
} |
} |
} |
return; |
return; |