Commit:    3f53bae495f989a168a7cd3b176d56fd7951c06b
Author:    Peter Kokot <peterko...@gmail.com>         Mon, 26 Nov 2018 08:16:52 
+0100
Parents:   8283c32cded6e5d3dac87dcc7be8f43176799327
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=3f53bae495f989a168a7cd3b176d56fd7951c06b

Log:
Limit username length to 16 characters

According to master.php.net database username field of varchar(16) the
maximum length for Git usernames is 16 characters.

Changed paths:
  M  git-php.php


Diff:
diff --git a/git-php.php b/git-php.php
index bdfff2d..d60d120 100644
--- a/git-php.php
+++ b/git-php.php
@@ -58,8 +58,8 @@ if (count($_POST) && (!isset($_POST['purpose']) || 
!is_array($_POST['purpose'])
     // Check for errors
     if (empty($_POST['id'])) {
         $error .= "You must supply a desired Git user id. <br>";
-    } elseif(!preg_match('!^[a-z]\w+$!', $_POST['id'])) {
-        $error .= "Your user id must be >1 char long, start with ".
+    } elseif(!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) 
> 16) {
+        $error .= "Your user id must be from 1-16 characters long, start with 
".
                   "a letter and contain nothing but a-z, 0-9, and _ <br>";
     }
     if (empty($_POST['fullname'])) {
@@ -394,7 +394,7 @@ foreach ($purposes as $i => $p) { ?>
 <td><input type="checkbox" name="guidelines" value="1" id="vcs-guidelines"> 
<label for="vcs-guidelines">Check the box if you agree</label></td>
 </tr>
 <tr>
- <th class="subr">User ID:<br> <small>(single word, lower case)</small></th>
+ <th class="subr">User ID:<br> <small>(single word, lower case, max 16 
characters)</small></th>
  <td><input type="text" size="10" name="id"
       class="max" value="<?php if (isset($_POST['id'])) echo 
clean($_POST['id']);?>"></td>
 </tr>


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to