Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.727
diff -u -p -r1.727 user.module
--- modules/user/user.module	7 Dec 2006 19:06:34 -0000	1.727
+++ modules/user/user.module	7 Dec 2006 22:33:51 -0000
@@ -6,6 +6,9 @@
  * Enables the user registration and login system.
  */
 
+define('USERNAME_MAX_LENGTH', 60);
+define('EMAIL_MAX_LENGTH', 64);
+
 /**
  * Invokes hook_user() in every module.
  *
@@ -254,7 +257,7 @@ function user_validate_name($name) {
     return t('The username contains an illegal character.');
   }
   if (ereg('@', $name) && !eregi('@([0-9a-z](-?[0-9a-z])*.)+[a-z]{2}([zmuvtg]|fo|me)?$', $name)) return t('The username is not a valid authentication ID.');
-  if (strlen($name) > 56) return t('The username %name is too long: it must be less than 56 characters.', array('%name' => $name));
+  if (strlen($name) > USERNAME_MAX_LENGTH) return t('The username %name is too long: it must be %max characters or less.', array('%name' => $name, '%max' => USERNAME_MAX_LENGTH));
 }
 
 function user_validate_mail($mail) {
@@ -477,7 +480,7 @@ function user_login_block() {
   );
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username'),
-    '#maxlength' => 60,
+    '#maxlength' => USERNAME_MAX_LENGTH,
     '#size' => 15,
     '#required' => TRUE,
   );
@@ -892,7 +895,7 @@ function user_login($msg = '') {
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username'),
     '#size' => 30,
-    '#maxlength' => 60,
+    '#maxlength' => USERNAME_MAX_LENGTH,
     '#required' => TRUE,
     '#attributes' => array('tabindex' => '1'),
   );
@@ -1029,7 +1032,7 @@ function user_pass() {
   $form['name'] = array('#type' => 'textfield',
     '#title' => t('Username or e-mail address'),
     '#size' => 30,
-    '#maxlength' => 60,
+    '#maxlength' => max(USERNAME_MAX_LENGTH, EMAIL_MAX_LENGTH),
     '#required' => TRUE,
   );
   $form['submit'] = array('#type' => 'submit',
@@ -1290,15 +1293,15 @@ function user_edit_form($uid, $edit, $re
     $form['account']['name'] = array('#type' => 'textfield',
       '#title' => t('Username'),
       '#default_value' => $edit['name'],
-      '#maxlength' => 60,
-      '#description' => t('Your full name or your preferred username: only letters, numbers and spaces are allowed.'),
+      '#maxlength' => USERNAME_MAX_LENGTH,
+      '#description' => t('Your full name or your preferred username: only letters, numbers, spaces, periods, dashes, and underscores are allowed.'),
       '#required' => TRUE,
     );
   }
   $form['account']['mail'] = array('#type' => 'textfield',
     '#title' => t('E-mail address'),
     '#default_value' => $edit['mail'],
-    '#maxlength' => 64,
+    '#maxlength' => EMAIL_MAX_LENGTH,
     '#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
     '#required' => TRUE,
   );
@@ -1547,7 +1550,7 @@ function _user_mail_text($messageid, $va
 
 function user_admin_check_user() {
   $form['user'] = array('#type' => 'fieldset', '#title' => t('Username'));
-  $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+  $form['user']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter a username to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => USERNAME_MAX_LENGTH);
   $form['user']['type'] = array('#type' => 'hidden', '#value' => 'user');
   $form['user']['submit'] = array('#type' => 'submit', '#value' => t('Check username'));
   $form['#base'] = 'user_admin_access_check';
@@ -1556,7 +1559,7 @@ function user_admin_check_user() {
 
 function user_admin_check_mail() {
   $form['mail'] = array('#type' => 'fieldset', '#title' => t('E-mail'));
-  $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => 64);
+  $form['mail']['test'] = array('#type' => 'textfield', '#title' => '', '#description' => t('Enter an e-mail address to check if it will be denied or allowed.'), '#size' => 30, '#maxlength' => EMAIL_MAX_LENGTH);
   $form['mail']['type'] = array('#type' => 'hidden', '#value' => 'mail');
   $form['mail']['submit'] = array('#type' => 'submit', '#value' => t('Check e-mail'));
   $form['#base'] = 'user_admin_access_check';
