--- loncom/auth/lonauth.pm 2021/11/17 00:44:47 1.170
+++ loncom/auth/lonauth.pm 2022/02/27 01:43:13 1.172
@@ -1,7 +1,7 @@
# The LearningOnline Network
# User Authentication Module
#
-# $Id: lonauth.pm,v 1.170 2021/11/17 00:44:47 raeburn Exp $
+# $Id: lonauth.pm,v 1.172 2022/02/27 01:43:13 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -300,7 +300,7 @@ ENDSUCCESS
# --------------------------------------------------------------- Failed login!
sub failed {
- my ($r,$message,$form) = @_;
+ my ($r,$message,$form,$authhost) = @_;
(undef,undef,undef,my $clientmathml,my $clientunicode) =
&Apache::loncommon::decode_user_agent();
my $args = {};
@@ -308,14 +308,19 @@ sub failed {
$args = {'browser.unicode' => 1};
}
+ my @actions;
my $start_page = &Apache::loncommon::start_page('Unsuccessful Login',undef,$args);
my $uname = &Apache::loncommon::cleanup_html($form->{'uname'});
my $udom = &Apache::loncommon::cleanup_html($form->{'udom'});
if (&Apache::lonnet::domain($udom,'description') eq '') {
undef($udom);
}
+ my $authtype;
+ if (($udom ne '') && ($uname ne '') && ($authhost eq 'no_host')) {
+ $authtype = &Apache::lonnet::queryauthenticate($uname,$udom);
+ }
my $retry = '/adm/login';
- if ($uname eq $form->{'uname'}) {
+ if (($uname eq $form->{'uname'}) && ($authtype !~ /^lti:/)) {
$retry .= '?username='.$uname;
}
if ($udom) {
@@ -363,18 +368,28 @@ sub failed {
my $end_page = &Apache::loncommon::end_page();
&Apache::loncommon::content_type($r,'text/html');
$r->send_http_header;
- my @actions =
- (&mt('Please [_1]log in again[_2].','',''));
+ if ($authtype =~ /^lti:/) {
+ $message = &mt('Direct login is not supported with the username you entered.').
+ '
'.
+ &mt('You likely need to launch LON-CAPA from within a course in a different Learning Management System.').
+ '
'.
+ &mt('You can also try to log in with a different username.');
+ @actions =
+ (&mt('Try your [_1]log in again[_2].','',''));
+ } else {
+ $message = &mt($message);
+ @actions =
+ (&mt('Please [_1]log in again[_2].','',''));
+ }
my $loginhelp = &loginhelpdisplay($udom);
if ($loginhelp) {
push(@actions, ''.&mt('Login problems?').'');
}
#FIXME: link to helpdesk might be added here
-
$r->print(
$start_page
.'