Allow dash -' (except for first char) and underscore
_' in usernames.
pointed out by: max
This commit is contained in:
parent
aea88892fd
commit
d26d5268ed
@ -24,7 +24,7 @@
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
#
|
||||
# $Id: adduser.perl,v 1.23 1996/12/23 00:10:19 mpp Exp $
|
||||
# $Id: adduser.perl,v 1.24 1996/12/29 15:06:52 wosch Exp $
|
||||
|
||||
|
||||
# read variables
|
||||
@ -307,7 +307,7 @@ sub new_users_name {
|
||||
local($name);
|
||||
|
||||
while(1) {
|
||||
$name = &confirm_list("Enter username", 1, "A-Za-z0-9_", "");
|
||||
$name = &confirm_list("Enter username", 1, "a-z0-9_-", "");
|
||||
if (length($name) > 16) {
|
||||
warn "Username is longer than 16 chars\a\n";
|
||||
next;
|
||||
@ -320,7 +320,7 @@ sub new_users_name {
|
||||
sub new_users_name_valid {
|
||||
local($name) = @_;
|
||||
|
||||
if ($name !~ /^[a-z0-9]+$/) {
|
||||
if ($name !~ /^[a-z0-9_][a-z0-9_\-]*$/) {
|
||||
warn "Wrong username. " .
|
||||
"Please use only lowercase characters or digits\a\n";
|
||||
return 0;
|
||||
|
@ -30,7 +30,7 @@
|
||||
#
|
||||
# Guy Helmer <ghelmer@alpha.dsu.edu>, 07/17/96
|
||||
#
|
||||
# $Id: rmuser.perl,v 1.1 1996/11/17 03:51:33 wosch Exp $
|
||||
# $Id: rmuser.perl,v 1.2 1996/12/07 21:25:12 ache Exp $
|
||||
|
||||
sub LOCK_SH {0x01;}
|
||||
sub LOCK_EX {0x02;}
|
||||
@ -101,6 +101,8 @@ if ($< != 0) {
|
||||
if ($#ARGV == 0) {
|
||||
# Username was given as a parameter
|
||||
$login_name = pop(@ARGV);
|
||||
die "Sorry, login name must contain alphanumeric characters only.\n"
|
||||
if ($login_name !~ /^[a-z0-9_][a-z0-9_\-]*$/);
|
||||
} else {
|
||||
# Get the user name from the user
|
||||
$login_name = &get_login_name;
|
||||
@ -229,7 +231,7 @@ sub get_login_name {
|
||||
print "Enter login name for user to remove: ";
|
||||
$login_name = <>;
|
||||
chop $login_name;
|
||||
if (!($login_name =~ /[A-Za-z0-9_]/)) {
|
||||
if (!($login_name =~ /^[a-z0-9_][a-z0-9_\-]*$/)) {
|
||||
print STDERR "Sorry, login name must contain alphanumeric characters only.\n";
|
||||
} elsif (length($login_name) > 16 || length($login_name) == 0) {
|
||||
print STDERR "Sorry, login name must be 16 characters or less.\n";
|
||||
|
Loading…
Reference in New Issue
Block a user