version 1.85, 2021/12/10 04:14:52
|
version 1.90, 2025/02/18 17:45:11
|
Line 37 use Apache::lonacc;
|
Line 37 use Apache::lonacc;
|
use Apache::lonnet; |
use Apache::lonnet; |
use Apache::loncommon; |
use Apache::loncommon; |
use Apache::lonhtmlcommon; |
use Apache::lonhtmlcommon; |
use Apache::lonuserutils; |
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonauth; |
use Apache::lonauth; |
use Apache::resetpw; |
use Apache::resetpw; |
Line 95 sub handler {
|
Line 94 sub handler {
|
my $lonhost = $r->dir_config('lonHostID'); |
my $lonhost = $r->dir_config('lonHostID'); |
my $include = $r->dir_config('lonIncludes'); |
my $include = $r->dir_config('lonIncludes'); |
my $start_page; |
my $start_page; |
|
my $args = {}; |
|
|
|
(undef,undef,undef,my $clientmathml,my $clientunicode) = |
|
&Apache::loncommon::decode_user_agent(); |
|
if ($clientunicode && !$clientmathml) { |
|
$args->{'browser.unicode'} = 1; |
|
} |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
my $handle = &Apache::lonnet::check_for_valid_session($r); |
if (($handle ne '') && ($handle !~ /^publicuser_\d+$/)) { |
if (($handle ne '') && ($handle !~ /^publicuser_\d+$/)) { |
$start_page = |
$start_page = |
&Apache::loncommon::start_page('Already logged in'); |
&Apache::loncommon::start_page('Already logged in',undef,$args); |
my $end_page = |
my $end_page = |
&Apache::loncommon::end_page(); |
&Apache::loncommon::end_page(); |
$r->print($start_page."\n".'<h2>'.&mt('You are already logged in').'</h2>'. |
$r->print($start_page."\n".'<div class="LC_landmark" role="main">'. |
|
'<h2 class="LC_heading_2">'.&mt('You are already logged in').'</h2>'. |
'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', |
'<p>'.&mt('Please either [_1]continue the current session[_2] or [_3]log out[_4].', |
'<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>'). |
'<a href="/adm/roles">','</a>','<a href="/adm/logout">','</a>'). |
'</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p>'.$end_page); |
'</p><p><a href="/adm/loginproblems.html">'.&mt('Login problems?').'</a></p></div>'.$end_page); |
return OK; |
return OK; |
} |
} |
|
|
Line 140 sub handler {
|
Line 146 sub handler {
|
&print_footer($r); |
&print_footer($r); |
return OK; |
return OK; |
} else { |
} else { |
$start_page = &Apache::loncommon::start_page($title,$js); |
$start_page = &Apache::loncommon::start_page($title,$js,$args); |
&print_header($r,$start_page,$courseid); |
&print_header($r,$start_page,$courseid); |
$r->print($output); |
$r->print($output); |
&print_footer($r); |
&print_footer($r); |
Line 153 sub handler {
|
Line 159 sub handler {
|
my ($cancreate,$statustocreate,$statusforemail,$emailusername, |
my ($cancreate,$statustocreate,$statusforemail,$emailusername, |
$emailoptions,$verification,$emaildomain,$types,$usertypes,$othertitle) = |
$emailoptions,$verification,$emaildomain,$types,$usertypes,$othertitle) = |
&get_creation_controls($domain,$domconfig{'usercreation'}); |
&get_creation_controls($domain,$domconfig{'usercreation'}); |
my ($additems,$pagetitle); |
my ($pagetitle,$need_affiliation); |
if (ref($cancreate) eq 'ARRAY') { |
if (ref($cancreate) eq 'ARRAY') { |
unless (($env{'form.token'}) || ($sso_username ne '') || ($env{'form.phase'}) || |
unless (($env{'form.token'}) || ($sso_username ne '') || ($env{'form.phase'}) || |
($env{'form.create_with_email'})) { |
($env{'form.create_with_email'})) { |
Line 162 sub handler {
|
Line 168 sub handler {
|
if ((($usertype eq '') || (!grep(/^\Q$usertype\E$/,@{$statusforemail}))) && |
if ((($usertype eq '') || (!grep(/^\Q$usertype\E$/,@{$statusforemail}))) && |
(@{$statusforemail} > 0)) { |
(@{$statusforemail} > 0)) { |
$js .= &setelements_js($statusforemail,$types,$usertypes,$othertitle); |
$js .= &setelements_js($statusforemail,$types,$usertypes,$othertitle); |
$additems = {'add_entries' => { 'onload' => "setElements();"} }; |
$args->{'add_entries'} = { 'onload' => "setElements();"}; |
if ((@{$cancreate} == 1) && (@{$statusforemail} > 0)) { |
if ((@{$cancreate} == 1) && (@{$statusforemail} > 0)) { |
$pagetitle = 'Select affiliation'; |
$pagetitle = 'Select affiliation'; |
} |
} |
|
$need_affiliation = 1; |
} else { |
} else { |
$js .= &username_js(); |
$js .= &username_js(); |
} |
} |
} |
} |
} |
} |
} |
} |
$start_page = &Apache::loncommon::start_page($title,$js,$additems); |
$start_page = &Apache::loncommon::start_page($title,$js,$args); |
if (@{$cancreate} == 0) { |
if (@{$cancreate} == 0) { |
&print_header($r,$start_page,$courseid,$pagetitle); |
&print_header($r,$start_page,$courseid,$pagetitle); |
my $output = '<h3>'.&mt('Account creation unavailable').'</h3>'. |
my $output = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2>'. |
'<span class="LC_warning">'. |
'<span class="LC_warning">'. |
&mt('Creation of a new user account using an institutional log-in ID or e-mail verification is not permitted for: [_1].',$domdesc). |
&mt('Creation of a new user account using an institutional log-in ID or e-mail verification is not permitted for: [_1].',$domdesc). |
'</span><br /><br />'; |
'</span><br /><br />'; |
Line 189 sub handler {
|
Line 196 sub handler {
|
my ($msg,$sso_logout); |
my ($msg,$sso_logout); |
$sso_logout = &sso_logout_frag($r,$domain); |
$sso_logout = &sso_logout_frag($r,$domain); |
if (grep(/^sso$/,@{$cancreate})) { |
if (grep(/^sso$/,@{$cancreate})) { |
$msg = '<h3>'.&mt('Account creation').'</h3>'. |
$msg = '<h2 class="LC_heading_2">'.&mt('Account creation').'</h2>'. |
&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution.").'<br />'; |
&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution.").'<br />'; |
my $shibenv; |
my $shibenv; |
if (($r->dir_config('lonOtherAuthen') eq 'yes') && |
if (($r->dir_config('lonOtherAuthen') eq 'yes') && |
Line 223 sub handler {
|
Line 230 sub handler {
|
$lonhost,$contact_email,$contact_name, |
$lonhost,$contact_email,$contact_name, |
$sso_logout,$statustocreate,$shibenv); |
$sso_logout,$statustocreate,$shibenv); |
} else { |
} else { |
$msg = '<h3>'.&mt('Account creation unavailable').'</h3>'. |
$msg = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2>'. |
'<span class="LC_warning">'.&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution, and you are not permitted to create one.").'</span><br /><br />'.&mt('Please contact the [_1] ([_2]) for assistance.',$contact_name,$contact_email).'<hr />'. |
'<span class="LC_warning">'.&mt("Although your username and password were authenticated by your institution's Single Sign On system, you do not currently have a LON-CAPA account at this institution, and you are not permitted to create one.").'</span><br /><br />'.&mt('Please contact the [_1] ([_2]) for assistance.',$contact_name,$contact_email).'<hr />'. |
$sso_logout; |
$sso_logout; |
} |
} |
Line 328 sub handler {
|
Line 335 sub handler {
|
} elsif (!$token) { |
} elsif (!$token) { |
&print_header($r,$start_page,$courseid,$pagetitle); |
&print_header($r,$start_page,$courseid,$pagetitle); |
my $now=time; |
my $now=time; |
if ((grep(/^login$/,@{$cancreate})) && (!grep(/^email$/,@{$cancreate}))) { |
if ((grep(/^login$/,@{$cancreate})) && |
|
((!grep(/^email$/,@{$cancreate})) || ($need_affiliation))) { |
if (open(my $jsh,"<","$include/londes.js")) { |
if (open(my $jsh,"<","$include/londes.js")) { |
while(my $line = <$jsh>) { |
while(my $line = <$jsh>) { |
$r->print($line); |
$r->print($line); |
Line 528 sub javascript_checkpass {
|
Line 536 sub javascript_checkpass {
|
my $mismatchpass = &mt('The passwords you entered did not match.')."\n". |
my $mismatchpass = &mt('The passwords you entered did not match.')."\n". |
&mt('Please try again.'); |
&mt('Please try again.'); |
my ($numrules,$intargjs) = |
my ($numrules,$intargjs) = |
&Apache::lonuserutils::passwd_validation_js('upass',$domain); |
&Apache::loncommon::passwd_validation_js('upass',$domain); |
&js_escape(\$nopass); |
&js_escape(\$nopass); |
&js_escape(\$mismatchpass); |
&js_escape(\$mismatchpass); |
my $js = <<"ENDSCRIPT"; |
my $js = <<"ENDSCRIPT"; |
Line 615 sub print_username_form {
|
Line 623 sub print_username_form {
|
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>'.$lt{'crac'}.'</h3>'; |
$output = '<div class="LC_left_float"><h2 class="LC_heading_2">'.$lt{'crac'}.'</h2>'; |
$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 />'. |
$lt{'type'}. |
$lt{'type'}. |
Line 625 sub print_username_form {
|
Line 633 sub print_username_form {
|
} |
} |
} |
} |
if (grep(/^email$/,@{$cancreate})) { |
if (grep(/^email$/,@{$cancreate})) { |
$output .= '<div class="LC_left_float"><h3>'.$lt{'crae'}.'</h3>'; |
$output .= '<div class="LC_left_float"><h2 class="LC_heading_2">'.$lt{'crae'}.'</h2>'; |
if ($usertype ne '') { |
if ($usertype ne '') { |
if ((ref($statusforemail) eq 'ARRAY') && (@{$statusforemail} > 0)) { |
if ((ref($statusforemail) eq 'ARRAY') && (@{$statusforemail} > 0)) { |
unless (grep(/^\Q$usertype\E$/,@{$statusforemail})) { |
unless (grep(/^\Q$usertype\E$/,@{$statusforemail})) { |
Line 641 sub print_username_form {
|
Line 649 sub print_username_form {
|
unless (grep(/^default$/,@posstypes)) { |
unless (grep(/^default$/,@posstypes)) { |
push(@posstypes,'default'); |
push(@posstypes,'default'); |
} |
} |
$output .= '<p>'.&mt('Choose your affiliation at [_1]',$domdesc).'</p>'."\n". |
$output .= '<form name="reportstatus" id="LC_reportstatus" action="/adm/createaccount" method="post" '. |
'<form name="reportstatus" id="LC_reportstatus" action="/adm/createaccount" method="post" '. |
'onsubmit="return checkVerification();"><fieldset><legend>'. |
'onsubmit="return checkVerification();"><p>'; |
&mt('Choose your affiliation at [_1]',$domdesc).'</legend>'; |
foreach my $type (@posstypes) { |
foreach my $type (@posstypes) { |
my $name; |
my $name; |
if ($type eq 'default') { |
if ($type eq 'default') { |
Line 666 sub print_username_form {
|
Line 674 sub print_username_form {
|
if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) { |
if ($env{'form.courseid'} =~ /^$match_domain\_$match_courseid$/) { |
$output .= "\n".'<input type="hidden" name="courseid" value="'.$env{'form.courseid'}.'" />'; |
$output .= "\n".'<input type="hidden" name="courseid" value="'.$env{'form.courseid'}.'" />'; |
} |
} |
$output .= '</p>'."\n".'<p><input type="submit" name="reportedtype" value="'.&mt('Submit').'" /></p></form>'; |
$output .= "\n".'<p><input type="submit" name="reportedtype" value="'.&mt('Submit').'" />'. |
|
'</p></fieldset></form>'."\n"; |
} else { |
} else { |
my ($captchaform,$error,$captcha,$recaptchaversion) = |
my ($captchaform,$error,$captcha,$recaptchaversion) = |
&Apache::loncommon::captcha_display('usercreation',$lonhost); |
&Apache::loncommon::captcha_display('usercreation',$lonhost); |
Line 740 sub login_box {
|
Line 749 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="" autocomplete="off" />'; |
my $unameform = '<input type="text" name="uname" id="uname" size="20" value="" autocomplete="off" />'; |
my $upassform = '<input type="password" name="upass'.$now.'" size="20" autocomplete="off" />'; |
my $upassform = '<input type="password" name="upass'.$now.'" id="upass'.$now.'" size="20" autocomplete="new-password" />'; |
$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('<label for="uname">'.$titles{$context}.'</label>', |
'LC_pick_box_title')."\n". |
'LC_pick_box_title')."\n". |
$unameform."\n". |
$unameform."\n". |
&Apache::lonhtmlcommon::row_closure(1)."\n". |
&Apache::lonhtmlcommon::row_closure(1)."\n". |
&Apache::lonhtmlcommon::row_title(&mt('Password'), |
&Apache::lonhtmlcommon::row_title('<label for="upass'.$now.'">'.&mt('Password').'</label>', |
'LC_pick_box_title')."\n". |
'LC_pick_box_title')."\n". |
$upassform; |
$upassform; |
if ($context eq 'selfenroll') { |
if ($context eq 'selfenroll') { |
Line 762 sub login_box {
|
Line 771 sub login_box {
|
$output .= '<input type="hidden" name="udom" value="'.$domain.'" />'; |
$output .= '<input type="hidden" name="udom" value="'.$domain.'" />'; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(1). |
$output .= &Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title(). |
&Apache::lonhtmlcommon::row_title('<span class="LC_visually_hidden">'. |
|
&mt('Submit').'</span>','','','',1). |
'<br /><input type="submit" name="username_validation" value="'. |
'<br /><input type="submit" name="username_validation" value="'. |
$submit_text.'" />'."\n"; |
$submit_text.'" />'."\n"; |
if ($context eq 'selfenroll') { |
if ($context eq 'selfenroll') { |
Line 891 sub process_email_request {
|
Line 901 sub process_email_request {
|
$contact_email,$courseid,$emailusername,$usertype, |
$contact_email,$courseid,$emailusername,$usertype, |
$uname); |
$uname); |
} |
} |
return $output; |
return '<div class="LC_landmark" role="main">'.$output.'</div>'; |
} |
} |
|
|
sub call_rulecheck { |
sub call_rulecheck { |
Line 911 sub call_rulecheck {
|
Line 921 sub call_rulecheck {
|
sub send_token { |
sub send_token { |
my ($domain,$email,$server,$domdesc,$contact_name,$contact_email,$courseid,$emailusername, |
my ($domain,$email,$server,$domdesc,$contact_name,$contact_email,$courseid,$emailusername, |
$usertype,$uname) = @_; |
$usertype,$uname) = @_; |
my $msg = '<h3>'.&mt('Account creation status').'</h3>'. |
my $msg = '<h2 class="LC_heading_2">'.&mt('Account creation status').'</h2>'. |
&mt('Thank you for your request to create a new LON-CAPA account.'). |
&mt('Thank you for your request to create a new LON-CAPA account.'). |
'<br /><br />'; |
'<br /><br />'; |
my $now = time; |
my $now = time; |
Line 1255 ENDSERVERFORM
|
Line 1265 ENDSERVERFORM
|
'</form>'."\n"; |
'</form>'."\n"; |
my ($datatable,$rowcount) = |
my ($datatable,$rowcount) = |
&Apache::loncreateuser::personal_data_display('',$domain,'email','selfcreate', |
&Apache::loncreateuser::personal_data_display('',$domain,'email','selfcreate', |
'','',$now,$captchaform, |
'','','',$now,$captchaform, |
$emailusername,$usertype, |
$emailusername,$usertype, |
$usernameset,$condition,$excluded, |
$usernameset,$condition,$excluded, |
$showsubmit); |
$showsubmit); |
Line 1539 sub login_failure_msg {
|
Line 1549 sub login_failure_msg {
|
} else { |
} else { |
$url = "/adm/createaccount"; |
$url = "/adm/createaccount"; |
} |
} |
my $output = '<h4>'.&mt('Authentication failed').'</h4><div class="LC_warning">'. |
my $output = '<h3 class="LC_heading_3">'.&mt('Authentication failed').'</h3><div class="LC_warning">'. |
&mt('Username and/or password could not be authenticated.'). |
&mt('Username and/or password could not be authenticated.'). |
'</div>'. |
'</div>'. |
&mt('Please check the username and password.').'<br /><br />'; |
&mt('Please check the username and password.').'<br /><br />'; |
Line 1618 sub username_check {
|
Line 1628 sub username_check {
|
} |
} |
} |
} |
if ($checkfail) { |
if ($checkfail) { |
$msg = '<br /><h4>'.&mt('Account creation unavailable').'</h4>'; |
$msg = '<br /><h3 class="LC_heading_3">'.&mt('Account creation unavailable').'</h3>'; |
if ($checkfail eq 'username') { |
if ($checkfail eq 'username') { |
$msg .= '<span class="LC_warning">'. |
$msg .= '<span class="LC_warning">'. |
&mt('A LON-CAPA account may not be created with the username you use.'). |
&mt('A LON-CAPA account may not be created with the username you use.'). |
Line 1644 sub username_check {
|
Line 1654 sub username_check {
|
if ($rowcount) { |
if ($rowcount) { |
if ($editable) { |
if ($editable) { |
if ($courseid ne '') { |
if ($courseid ne '') { |
$msg = '<br /><h4>'.&mt('User information').'</h4>'; |
$msg = '<br /><h3 class="LC_heading_3">'.&mt('User information').'</h3>'; |
} |
} |
$msg .= &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />'; |
$msg .= &mt('To create one, use the table below to provide information about yourself, then click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />'; |
} else { |
} else { |
if ($courseid ne '') { |
if ($courseid ne '') { |
$msg = '<h4>'.&mt('Review user information').'</h4>'; |
$msg = '<h3 class="LC_heading_3">'.&mt('Review user information').'</h3>'; |
} |
} |
$msg .= &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />'; |
$msg .= &mt('A user account will be created with information displayed in the table below, when you click the [_1]Create LON-CAPA account[_2] button.','<span class="LC_cusr_emph">','</span>').'<br />'; |
} |
} |
} else { |
} else { |
if ($courseid ne '') { |
if ($courseid ne '') { |
$msg = '<h4>'.&mt('Confirmation').'</h4>'; |
$msg = '<h3 class="LC_heading_3">'.&mt('Confirmation').'</h3>'; |
} |
} |
$msg .= &mt('Confirm that you wish to create an account.'); |
$msg .= &mt('Confirm that you wish to create an account.'); |
} |
} |
Line 1796 sub check_id {
|
Line 1806 sub check_id {
|
|
|
sub invalid_state { |
sub invalid_state { |
my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_; |
my ($error,$domdesc,$contact_name,$contact_email,$msgtext) = @_; |
my $msg = '<h3>'.&mt('Account creation unavailable').'</h3><span class="LC_error">'; |
my $msg = '<h2 class="LC_heading_2">'.&mt('Account creation unavailable').'</h2><span class="LC_error">'; |
if ($error eq 'baduseremail') { |
if ($error eq 'baduseremail') { |
$msg .= &mt('The e-mail address you provided does not appear to be a valid address.'); |
$msg .= &mt('The e-mail address you provided does not appear to be a valid address.'); |
} elsif ($error eq 'badusername') { |
} elsif ($error eq 'badusername') { |