diff --git a/webui/user-add.php b/webui/user-add.php
index c27a4ad2211f8efca8554d1cfab3afa102ed4a5a..2879eacf2d4b6a2517c409bf5db44cd5bba455ba 100644
--- a/webui/user-add.php
+++ b/webui/user-add.php
@@ -60,6 +60,11 @@ if ($_POST['frmaction'] == "add") {
 	if (empty($_POST['user_name'])) {
 ?>
 		<div class="warning">Username cannot be empty</div>
+<?php
+	}
+	else if (!preg_match('/^[a-z0-9]+$/i', $_POST['user_name'])) {
+?>
+		<div class="warning">Username invalid: must be alphanumeric</div>
 <?php
 	# Add to database
 	} else {