Ticket #146: 20charusername.diff

File 20charusername.diff, 4.0 kB (added by ewout, 1 year ago)
  • mod/community/lib/communities_actions.php

    old new  
    2020            $comm_username = optional_param('comm_username'); 
    2121            if (logged_on && !empty($comm_name) && !empty($comm_username) && 
    2222                ($CFG->community_create_flag == "" || user_flag_get($CFG->community_create_flag, $USER->ident))) { 
    23                 if (!preg_match("/^[A-Za-z0-9]{3,12}$/",$comm_username)) { 
    24                     $messages[] = __gettext("Error! The community username must contain letters and numbers only, cannot be blank, and must be between 3 and 12 characters in length."); 
     23                if (!preg_match("/^[A-Za-z0-9]{3,20}$/",$comm_username)) { 
     24                    $messages[] = __gettext("Error! The community username must contain letters and numbers only, cannot be blank, and must be between 3 and 20 characters in length."); 
    2525                } else if (trim($comm_name) == "") { 
    2626                    $messages[] = __gettext("Error! The community name cannot be blank."); 
    2727                } else { 
  • mod/admin/lib/admin_actions.php

    old new  
    4040            $change_iconquota = optional_param('change_iconquota',0,PARAM_INT); 
    4141            if (!empty($id)) { 
    4242                if (!empty($change_username)) { 
    43                     if (!preg_match("/^[A-Za-z0-9]{3,12}$/",$change_username)) { 
    44                         $messages[] = __gettext("Error! The new username must contain letters and numbers only, cannot be blank, and must be between 3 and 12 characters in length."); 
     43                    if (!preg_match("/^[A-Za-z0-9]{3,20}$/",$change_username)) { 
     44                        $messages[] = __gettext("Error! The new username must contain letters and numbers only, cannot be blank, and must be between 3 and 20 characters in length."); 
    4545                    } else { 
    4646                        $u = new StdClass; 
    4747                        $u->username = $change_username; 
     
    124124                        continue; 
    125125                    } 
    126126                     
    127                     if (!preg_match("/^[A-Za-z0-9]{3,12}$/",$new_username[$i])) { 
    128                         $messages[] = sprintf(__gettext("New username %d (%s) was invalid; usernames must contain letters and numbers only, cannot be blank, and must be between 3 and 12 characters in length.") 
     127                    if (!preg_match("/^[A-Za-z0-9]{3,20}$/",$new_username[$i])) { 
     128                        $messages[] = sprintf(__gettext("New username %d (%s) was invalid; usernames must contain letters and numbers only, cannot be blank, and must be between 3 and 20 characters in length.") 
    129129                                              ,($i + 1),$new_username[$i]); 
    130130                        continue; 
    131131                    } 
  • mod/invite/lib/invite_actions.php

    old new  
    100100                 $messages[] = __gettext("Error! Invalid password. Your passwords must match and be between 6 and 16 characters in length."); 
    101101                 break; 
    102102             } 
    103              if (!preg_match("/^[A-Za-z0-9]{3,12}$/",$username)) { 
    104                  $messages[] = __gettext("Error! Your username must contain letters and numbers only, cannot be blank, and must be between 3 and 12 characters in length."); 
     103             if (!preg_match("/^[A-Za-z0-9]{3,20}$/",$username)) { 
     104                 $messages[] = __gettext("Error! Your username must contain letters and numbers only, cannot be blank, and must be between 3 and 20 characters in length."); 
    105105                 break; 
    106106             } 
    107107             $username = strtolower($username);