version 1.58, 2014/02/12 20:47:40
|
version 1.59, 2014/02/19 17:20:32
|
Line 291 sub print_footer {
|
Line 291 sub print_footer {
|
&Apache::lonhtmlcommon::echo_form_input(['backto','logtoken', |
&Apache::lonhtmlcommon::echo_form_input(['backto','logtoken', |
'token','serverid','uname','upass','phase','create_with_email', |
'token','serverid','uname','upass','phase','create_with_email', |
'code','crypt','cfirstname','clastname', |
'code','crypt','cfirstname','clastname', |
|
'recaptcha_challenge_field','recaptcha_response_field', |
'cmiddlename','cgeneration','cpermanentemail','cid']). |
'cmiddlename','cgeneration','cpermanentemail','cid']). |
'</form>'); |
'</form>'); |
} |
} |
Line 321 sub selfenroll_crumbs {
|
Line 322 sub selfenroll_crumbs {
|
} |
} |
|
|
sub javascript_setforms { |
sub javascript_setforms { |
my ($now,$emailusername) = @_; |
my ($now,$emailusername,$captcha) = @_; |
my $setuserinfo; |
my $setuserinfo; |
if (ref($emailusername) eq 'HASH') { |
if (ref($emailusername) eq 'HASH') { |
foreach my $key (sort(keys(%{$emailusername}))) { |
foreach my $key (sort(keys(%{$emailusername}))) { |
$setuserinfo .= ' server.elements.'.$key.'.value=client.elements.'.$key.'.value;'."\n"; |
$setuserinfo .= ' server.elements.'.$key.'.value=client.elements.'.$key.'.value;'."\n"; |
} |
} |
|
if ($captcha eq 'original') { |
|
$setuserinfo .= ' server.elements.code.value=client.elements.code.value;'."\n". |
|
' server.elements.crypt.value=client.elements.crypt.value;'."\n"; |
|
} elsif ($captcha eq 'recaptcha') { |
|
$setuserinfo .= ' server.elements.recaptcha_challenge_field.value=client.elements.recaptcha_challenge_field.value;'."\n". |
|
' server.elements.recaptcha_response_field.value=client.elements.recaptcha_response_field.value;'."\n"; |
|
} |
} |
} |
my $js = <<ENDSCRIPT; |
my $js = <<ENDSCRIPT; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 343 sub javascript_setforms {
|
Line 351 sub javascript_setforms {
|
if (context == 'email') { |
if (context == 'email') { |
$setuserinfo |
$setuserinfo |
} |
} |
server.elements.code.value=client.elements.code.value; |
|
server.elements.crypt.value=client.elements.crypt.value; |
|
|
|
uextkey=client.elements.uextkey.value; |
uextkey=client.elements.uextkey.value; |
lextkey=client.elements.lextkey.value; |
lextkey=client.elements.lextkey.value; |
Line 428 ENDSCRIPT
|
Line 434 ENDSCRIPT
|
|
|
sub print_username_form { |
sub print_username_form { |
my ($r,$domain,$domdesc,$cancreate,$now,$lonhost,$include,$courseid,$gotlondes,$emailusername) = @_; |
my ($r,$domain,$domdesc,$cancreate,$now,$lonhost,$include,$courseid,$gotlondes,$emailusername) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash ( |
unam => 'username', |
unam => 'username', |
udom => 'domain', |
udom => 'domain', |
uemail => 'E-mail address in LON-CAPA', |
uemail => 'E-mail address in LON-CAPA', |
proc => 'Proceed'); |
proc => 'Proceed', |
|
crac => 'Create account with a username provided by this institution', |
|
clca => 'Create LON-CAPA account', |
|
type => 'Type in your log-in ID and password to find out.', |
|
plse => 'Please provide a password for your new account.', |
|
info => 'Please provide user information and a password for your new account.', |
|
yopw => 'Your password will be encrypted when sent (and stored).', |
|
); |
my $output; |
my $output; |
if (ref($cancreate) eq 'ARRAY') { |
if (ref($cancreate) eq 'ARRAY') { |
if (grep(/^login$/,@{$cancreate})) { |
if (grep(/^login$/,@{$cancreate})) { |
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); |
my %domdefaults = &Apache::lonnet::get_domain_defaults($domain); |
if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) { |
if ((($domdefaults{'auth_def'} =~/^krb/) && ($domdefaults{'auth_arg_def'} ne '')) || ($domdefaults{'auth_def'} eq 'localauth')) { |
$output = '<div class="LC_left_float"><h3>'.&mt('Create account with a username provided by this institution').'</h3>'; |
$output = '<div class="LC_left_float"><h3>'.$lt{'crac'}.'</h3>'; |
my $submit_text = &mt('Create LON-CAPA account'); |
$output .= &mt('If you already have a log-in ID at this institution [_1]you may be able to use it for LON-CAPA.','<br />'). |
$output .= &mt('If you already have a log-in ID at this institution,[_1] you may be able to use it for LON-CAPA.','<br />'). |
|
'<br /><br />'. |
'<br /><br />'. |
&mt('Type in your log-in ID and password to find out.'). |
$lt{'type'}. |
'<br /><br />'; |
'<br /><br />'; |
$output .= &login_box($now,$lonhost,$courseid,$submit_text, |
$output .= &login_box($now,$lonhost,$courseid,$lt{'clca'}, |
$domain,'createaccount').'</div>'; |
$domain,'createaccount').'</div>'; |
} |
} |
} |
} |
if (grep(/^email(|approval)$/,@{$cancreate})) { |
if (grep(/^email(|approval)$/,@{$cancreate})) { |
$output .= '<div class="LC_left_float"><h3>'.&mt('Create account with an e-mail address as your username').'</h3>'; |
$output .= '<div class="LC_left_float"><h3>'.&mt('Create account with an e-mail address as your username').'</h3>'; |
my ($captchaform,$error) = &Apache::loncommon::captcha_display('usercreation',$lonhost); |
my ($captchaform,$error,$captcha) = &Apache::loncommon::captcha_display('usercreation',$lonhost); |
if ($error) { |
if ($error) { |
my $helpdesk = '/adm/helpdesk?origurl=%2fadm%2fcreateaccount'; |
my $helpdesk = '/adm/helpdesk?origurl=%2fadm%2fcreateaccount'; |
if ($courseid ne '') { |
if ($courseid ne '') { |
Line 463 sub print_username_form {
|
Line 475 sub print_username_form {
|
'<a href="'.$helpdesk.'">','</a>','<a href="javascript:window.location.reload()">'); |
'<a href="'.$helpdesk.'">','</a>','<a href="javascript:window.location.reload()">'); |
} else { |
} else { |
if (grep(/^login$/,@{$cancreate})) { |
if (grep(/^login$/,@{$cancreate})) { |
$output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.','<br />').'<br /><br />'; |
$output .= &mt('If you do not have a log-in ID at your institution, [_1]provide your e-mail address to request a LON-CAPA account.','<br />').'<br /><br />'. |
} else { |
$lt{'plse'}.'<br />'. |
$output .= '<br />'; |
$lt{'yopw'}.'<br />'; |
} |
|
$output .= &mt('Please provide user information and a password for your new account.').'<br />'. |
|
&mt('Your password, which must contain at least seven characters, will be sent to the LON-CAPA server in an encrypted form.').'<br />'; |
|
if (grep(/^login$/,@{$cancreate})) { |
|
$output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.','<br />').'<br /><br />'; |
|
} else { |
|
$output .= '<br />'; |
|
} |
|
$output .= &print_dataentry_form($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$gotlondes,$emailusername); |
|
if (grep(/^login$/,@{$cancreate})) { |
|
$output .= &mt('Provide your e-mail address to request a LON-CAPA account,[_1] if you do not have a log-in ID at your institution.','<br />').'<br /><br />'; |
|
} else { |
} else { |
$output .= '<br />'; |
my $prompt = $lt{'plse'}; |
|
if (ref($emailusername) eq 'HASH') { |
|
foreach my $key (keys(%{$emailusername})) { |
|
if ($emailusername->{$key}) { |
|
$prompt = $lt{'info'}; |
|
last; |
|
} |
|
} |
|
} |
|
$output .= $prompt.'<br />'. |
|
$lt{'yopw'}.'<br />'; |
} |
} |
|
$output .= &print_dataentry_form($r,$domain,$lonhost,$include,$now,$captchaform, |
|
$courseid,$gotlondes,$emailusername,$captcha); |
} |
} |
$output .= '</div>'; |
$output .= '</div>'; |
} |
} |
Line 504 sub login_box {
|
Line 517 sub login_box {
|
my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount', |
my $logtoken=Apache::lonnet::reply('tmpput:'.$ukey.$lkey.'&createaccount:createaccount', |
$lonhost); |
$lonhost); |
$output = &serverform($logtoken,$lonhost,undef,$courseid,$context); |
$output = &serverform($logtoken,$lonhost,undef,$courseid,$context); |
my $unameform = '<input type="text" name="uname" size="20" value="" />'; |
my $unameform = '<input type="text" name="uname" size="20" value="" autocomplete="off" />'; |
my $upassform = '<input type="password" name="upass'.$now.'" size="20" />'; |
my $upassform = '<input type="password" name="upass'.$now.'" size="20" autocomplete="off" />'; |
$output .= '<form name="client" method="post" action="" onsubmit="return(send('."'server','client'".'));">'."\n". |
$output .= '<form name="client" method="post" action="" onsubmit="return(send('."'server','client'".'));">'."\n". |
&Apache::lonhtmlcommon::start_pick_box()."\n". |
&Apache::lonhtmlcommon::start_pick_box()."\n". |
&Apache::lonhtmlcommon::row_title($titles{$context}, |
&Apache::lonhtmlcommon::row_title($titles{$context}, |
Line 776 sub start_session {
|
Line 789 sub start_session {
|
# Stores token to store DES-key and stage during creation session |
# Stores token to store DES-key and stage during creation session |
# |
# |
sub print_dataentry_form { |
sub print_dataentry_form { |
my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$gotlondes,$emailusername) = @_; |
my ($r,$domain,$lonhost,$include,$now,$captchaform,$courseid,$gotlondes,$emailusername,$captcha) = @_; |
my ($error,$output); |
my ($error,$output); |
unless ($gotlondes) { |
unless ($gotlondes) { |
if (open(my $jsh,"<$include/londes.js")) { |
if (open(my $jsh,"<$include/londes.js")) { |
Line 784 sub print_dataentry_form {
|
Line 797 sub print_dataentry_form {
|
$r->print($line); |
$r->print($line); |
} |
} |
close($jsh); |
close($jsh); |
$output = &javascript_setforms($now,$emailusername)."\n"; |
$output = &javascript_setforms($now,$emailusername,$captcha)."\n"; |
$gotlondes = 1; |
$gotlondes = 1; |
} |
} |
} |
} |
Line 804 sub print_dataentry_form {
|
Line 817 sub print_dataentry_form {
|
$output .= '<input type="hidden" name="'.$field.'" value="" />'."\n"; |
$output .= '<input type="hidden" name="'.$field.'" value="" />'."\n"; |
} |
} |
} |
} |
|
if ($captcha eq 'original') { |
|
$output .= ' |
|
<input type="hidden" name="crypt" value="" /> |
|
<input type="hidden" name="code" value="" /> |
|
'; |
|
} elsif ($captcha eq 'recaptcha') { |
|
$output .= ' |
|
<input type="hidden" name="recaptcha_challenge_field" value="" /> |
|
<input type="hidden" name="recaptcha_response_field" value="" /> |
|
'; |
|
} |
$output .= <<"ENDSERVERFORM"; |
$output .= <<"ENDSERVERFORM"; |
<input type="hidden" name="logtoken" value="$logtoken" /> |
<input type="hidden" name="logtoken" value="$logtoken" /> |
<input type="hidden" name="serverid" value="$lonhost" /> |
<input type="hidden" name="serverid" value="$lonhost" /> |
<input type="hidden" name="uname" value="" /> |
<input type="hidden" name="uname" value="" /> |
<input type="hidden" name="upass" value="" /> |
<input type="hidden" name="upass" value="" /> |
<input type="hidden" name="udom" value="" /> |
<input type="hidden" name="udom" value="" /> |
<input type="hidden" name="crypt" value="" /> |
|
<input type="hidden" name="code" value="" /> |
|
<input type="hidden" name="phase" value="createaccount" /> |
<input type="hidden" name="phase" value="createaccount" /> |
<input type="hidden" name="create_with_email" value="1" /> |
<input type="hidden" name="create_with_email" value="1" /> |
</form> |
</form> |
Line 879 sub get_creation_controls {
|
Line 901 sub get_creation_controls {
|
} |
} |
if (ref($usercreation->{'cancreate'}{'emailusername'}) eq 'HASH') { |
if (ref($usercreation->{'cancreate'}{'emailusername'}) eq 'HASH') { |
$emailusername = $usercreation->{'cancreate'}{'emailusername'}; |
$emailusername = $usercreation->{'cancreate'}{'emailusername'}; |
|
} else { |
|
$emailusername = {'lastname' => '1', 'firstname' => 1, }; |
} |
} |
} |
} |
} |
} |