Kaynağa Gözat

Allow spaces in Full Names

Serghey Rodin 12 yıl önce
ebeveyn
işleme
d27cfa7590
3 değiştirilmiş dosya ile 15 ekleme ve 4 silme
  1. 11 2
      func/main.sh
  2. 2 0
      web/edit/user/index.php
  3. 2 2
      web/templates/admin/edit_user.html

+ 11 - 2
func/main.sh

@@ -605,6 +605,15 @@ validate_format_name() {
     fi
 }
 
+# Name with space
+validate_format_name_s() {
+    if ! [[ "$1" =~ ^[[:alnum:]][-|\ |\.|_[:alnum:]]{0,28}[[:alnum:]]$ ]]; then
+        echo "Error: $2 $1 is not valid"
+        log_event "$E_INVALID" "$EVENT"
+        exit $E_INVALID
+    fi
+}
+
 # Username
 validate_format_username() {
     if ! [[ "$1" =~ ^[a-zA-Z0-9][-|\.|_|a-zA-Z0-9]{0,28}[a-zA-Z0-9]$ ]]; then
@@ -795,7 +804,7 @@ validate_format(){
             email)          validate_format_email "$arg" ;;
             exp)            validate_format_date "$arg" ;;
             extentions)     validate_format_common "$arg" 'extentions' ;;
-            fname)          validate_format_name "$arg" "$arg_name" ;;
+            fname)          validate_format_name_s "$arg" "$arg_name" ;;
             forward)        validate_format_email "$arg" ;;
             ftp_password)   validate_format_password "$arg" ;;
             ftp_user)       validate_format_username "$arg" "$arg_name" ;;
@@ -808,7 +817,7 @@ validate_format(){
             ip_status)      validate_format_ip_status "$arg" ;;
             job)            validate_format_int "$arg" 'job' ;;
             key)            validate_format_username "$arg" "$arg_name" ;;
-            lname)          validate_format_name "$arg" "$arg_name" ;;
+            lname)          validate_format_name_s "$arg" "$arg_name" ;;
             malias)         validate_format_username "$arg" "$arg_name" ;;
             mask)           validate_format_ip "$arg" ;;
             max_db)         validate_format_int "$arg" 'max db';;

+ 2 - 0
web/edit/user/index.php

@@ -120,6 +120,8 @@ if ($_SESSION['user'] == 'admin') {
             exec (VESTA_CMD."v-change-user-name ".$v_username." ".$v_fname." ".$v_lname, $output, $return_var);
             check_return_code($return_var,$output);
             unset($output);
+            $v_fname = $_POST['v_fname'];
+            $v_lname = $_POST['v_lname'];
         }
 
         // Change NameServers

+ 2 - 2
web/templates/admin/edit_user.html

@@ -139,7 +139,7 @@
                             </tr>
                             <tr>
                                 <td>
-                                    <input type="text" size="20" class="vst-input" name="v_fname" <?php if (!empty($v_fname)) echo "value=".$v_fname; ?>>
+                                    <input type="text" size="20" class="vst-input" name="v_fname" <?php if (!empty($v_fname)) echo "value=\"".$v_fname."\""; ?>>
                                 </td>
                             </tr>
                             <tr>
@@ -149,7 +149,7 @@
                             </tr>
                             <tr>
                                 <td>
-                                    <input type="text" size="20" class="vst-input" name="v_lname" <?php if (!empty($v_lname)) echo "value=".$v_lname; ?>>
+                                    <input type="text" size="20" class="vst-input" name="v_lname" <?php if (!empty($v_lname)) echo "value=\"".$v_lname."\""; ?>>
                                 </td>
                             </tr>
                             <tr>