[LON-CAPA-cvs] cvs: loncom /interface resetpw.pm

bisitz bisitz at source.lon-capa.org
Fri Feb 1 12:39:22 EST 2013


bisitz		Fri Feb  1 17:39:22 2013 EDT

  Modified files:              
    /loncom/interface	resetpw.pm 
  Log:
  Improvements to Reset Password Form - Phase 1 (enter personal data):
  - Consistent and standard layout
  - Error style for server side errors
  - Consistent wording
  - Re-use existing phrases
  - Highlight domain description
  - Consistent navigation in case of errors (new subroutine for all cases):
      - Actionbox
      - Offer "Go back" link to encourage users to try again instead of directly contacting the helpdesk (, e.g. only a little typo).
      - Offer link to helpdesk to allow to provide all needed data in case trying again didn't help
  
  
  
Index: loncom/interface/resetpw.pm
diff -u loncom/interface/resetpw.pm:1.28 loncom/interface/resetpw.pm:1.29
--- loncom/interface/resetpw.pm:1.28	Tue Oct  2 18:08:12 2012
+++ loncom/interface/resetpw.pm	Fri Feb  1 17:39:22 2013
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Allow access to password changing via a token sent to user's e-mail. 
 #
-# $Id: resetpw.pm,v 1.28 2012/10/02 18:08:12 bisitz Exp $
+# $Id: resetpw.pm,v 1.29 2013/02/01 17:39:22 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -206,7 +206,10 @@
 sub send_token {
     my ($uname,$udom,$email,$server,$domdesc,$contact_name,
         $contact_email) = @_;
-    my $msg = &mt('Thank you for your request to reset the password for your LON-CAPA account.').'<br /><br />';
+    my $msg =
+        '<p class="LC_info">'
+       .&mt('Thank you for your request to reset the password for your LON-CAPA account.')
+       .'</p>';
 
     my $now = time;
     my $temppasswd = &create_passwd();
@@ -229,21 +232,20 @@
             $msg .= &mt("An e-mail sent to the e-mail address associated with your LON-CAPA account includes the web address for the link you should use to complete the reset process.<br /><br />The link included in the message will be valid for the next <b>two</b> hours.");
         } else {
             $msg .=
-                '<p class="LC_warning">'
-               .&mt("An error occurred when sending a message to the e-mail address"
-                   ." associated with your LON-CAPA account."
-                   ." Please contact the [_1] ([_2]) for assistance."
-                    ,$contact_name,$contact_email)
-               .'</p>';
+                '<p class="LC_error">'
+               .&mt('An error occurred when sending a message to the e-mail address'
+                   .' associated with your LON-CAPA account.')
+               .'</p>'
+               .&display_actions($contact_email,$domdesc);
+
         }
     } else {
         $msg .=
-            '<p class="LC_warning">'
-           .&mt("An error occurred creating a token required for the"
-               ." password reset process."
-               ." Please contact the [_1] ([_2]) for assistance."
-                ,$contact_name,$contact_email)
-           .'</p>';
+            '<p class="LC_error">'
+           .&mt('An error occurred creating a token required for the'
+               .' password reset process.')
+           .'</p>'
+           .&display_actions($contact_email,$domdesc);
     }
     return $msg;
 }
@@ -272,8 +274,12 @@
     my ($error,$domdesc,$contact_name,$contact_email) = @_;
     my $msg;
     if ($error eq 'invalid') {
-        $msg = '<p class="LC_warning">'.&mt('The username you provided was not verified as a valid username in the LON-CAPA system for the [_1] domain.',$domdesc)
-              .'</p>'.&mt('Please [_1]go back[_2] and try again.','<a href="javascript:history.go(-1)"><u>','</u></a>');
+        $msg =
+            '<p class="LC_warning">'
+            .&mt('The username you provided was not verified as a valid username'
+                .' in the LON-CAPA system for the [_1] domain.','<i>'.$domdesc.'</i>')
+              .'</p>';
+        $msg .= &display_actions($contact_email,$domdesc);
     } else {
         if ($error eq 'baduseremail') {
             $msg = &mt('The e-mail address you provided does not appear to be a valid address.');
@@ -284,14 +290,8 @@
         } elsif ($error eq 'authentication') {
             $msg = &mt('The username you provided uses an authentication type which can not be reset directly via LON-CAPA.');
         }
-        $msg = '<p class="LC_warning">'.$msg.'</p>';
-        if ($contact_email ne '') {
-            my $escuri = &HTML::Entities::encode('/adm/resetpw','&<>"');
-            $msg .= '<br /> '.&mt('You may wish to contact the [_1]LON-CAPA helpdesk[_2] for the [_3] domain.'
-                                 ,'<a href="/adm/helpdesk?origurl='.$escuri.'">','</a>',$domdesc);
-        } else {
-            $msg .= '<br /> '.&mt('You may wish to send an e-mail to the server administrator: [_1] for the [_2] domain.',$Apache::lonnet::perlvar{'AdminEmail'},$domdesc);
-        }
+        $msg = '<p class="LC_warning">'.$msg.'</p>'
+              .&display_actions($contact_email,$domdesc);
     }
     return $msg;
 }
@@ -395,9 +395,10 @@
 sub generic_failure_msg {
     my ($contact_name,$contact_email) = @_;
     return
-        '<p class="LC_warning">'
-       .&mt('A problem occurred when attempting to reset the password for your account.'
-           .' Please contact the [_1] - ([_2]) for assistance.',
+        '<p class="LC_error">'
+       .&mt('A problem occurred when attempting to reset the password for your account.')
+       .'<br />'
+       .&mt('Please contact the [_1] - ([_2]) for assistance.',
               $contact_name,'<a href="mailto:'.$contact_email.'">'.$contact_email.'</a>')
        .'</p>';
 }
@@ -422,4 +423,28 @@
     return ($passwd);
 }
 
+sub display_actions {
+    my ($contact_email, $domdesc) = @_;
+    my @msg = (&mt('[_1]Go back[_2] and try again',
+                   '<a href="javascript:history.go(-1)">','</a>'));
+    my $msg2 = '';
+    if ($contact_email ne '') {
+            my $escuri = &HTML::Entities::encode('/adm/resetpw','&<>"');
+            push(@msg, &mt('Contact the [_1]LON-CAPA helpdesk[_2] for the institution: [_3]',
+                           '<a href="/adm/helpdesk?origurl='.$escuri.'">',
+                           '</a>','<i>'.$domdesc.'</i>'));
+        } else {
+            $msg2 =
+                '<p>'
+                .&mt('You may wish to send an e-mail to the'
+                    .' server administrator: [_1] for the [_2] domain.',
+                         '<i>'.$Apache::lonnet::perlvar{'AdminEmail'}.'</i>',
+                         '<i>'.$domdesc.'</i>')
+                .'</p>';
+        }
+
+    return &Apache::lonhtmlcommon::actionbox(\@msg).$msg2;
+
+}
+
 1;




More information about the LON-CAPA-cvs mailing list