commit 7399c297b6c349a33c909be832541307b230350f
Author: jim-p <jimp@netgate.com>
Date:   Wed Feb 25 12:24:27 2026 -0500

    Respect cert checkbox when creating a user. Fixes #16721
    
    Also fixes a case where the form was not displaying properly when there
    were input errors. This likely needs more testing to confirm each action
    case is being handled properly with and without input errors in the
    submission.

diff --git a/src/usr/local/www/system_usermanager.php b/src/usr/local/www/system_usermanager.php
index 4c1222b7cb..542250847f 100644
--- a/src/usr/local/www/system_usermanager.php
+++ b/src/usr/local/www/system_usermanager.php
@@ -213,7 +213,7 @@ if ($_POST['save'] && !$read_only) {
 		$reqdfields = explode(" ", "usernamefld");
 		$reqdfieldsn = array(gettext("Username"));
 	} else {
-		if (empty($_POST['name'])) {
+		if ($_POST['createcert'] != "yes") {
 			$reqdfields = explode(" ", "usernamefld passwordfld1");
 			$reqdfieldsn = array(
 				gettext("Username"),
@@ -299,7 +299,7 @@ if ($_POST['save'] && !$read_only) {
 		}
 	}
 
-	if (!empty($_POST['name'])) {
+	if ($_POST['createcert'] == "yes") {
 		$ca = lookup_ca($_POST['caref']);
 		$ca = $ca['item'];
 		if (!$ca) {
@@ -433,7 +433,7 @@ if ($_POST['save'] && !$read_only) {
 		if (isset($id) && config_get_path("system/user/{$id}")) {
 			config_set_path("system/user/{$id}", $userent);
 		} else {
-			if (!empty($_POST['name'])) {
+			if ($_POST['createcert'] == "yes") {
 				$cert = array();
 				$cert['refid'] = uniqid();
 				$userent['cert'] = array();
@@ -765,7 +765,7 @@ if ($act == "new" || $act == "edit" || $input_errors):
 		'act',
 		null,
 		'hidden',
-		''
+		$act
 	));
 
 	$form->addGlobal(new Form_Input(
@@ -950,9 +950,9 @@ if ($act == "new" || $act == "edit" || $input_errors):
 	if ($act == 'new') {
 		if (count($nonPrvCas) > 0) {
 			$section->addInput(new Form_Checkbox(
-				'showcert',
+				'createcert',
 				'Certificate',
-				'Click to create a user certificate',
+				'Create a user certificate',
 				false
 			));
 		} else {
@@ -1157,7 +1157,7 @@ events.push(function() {
 		moveOptions($('[name="sysgroups[]"] option'), $('[name="groups[]"]'));
 	});
 
-	$("#showcert").click(function() {
+	$("#createcert").click(function() {
 		hideClass('cert-options', !this.checked);
 	});
 
