Changeset

10373:51ea82f55322

MUC: Make nickname field in registration form required Prevents traceback from resourceprep(nil) muc#register_roomnick is also required in XEP-0045
author Kim Alvefur <zash@zash.se>
date Sat, 02 Nov 2019 14:22:06 +0100
parents 10372:5482f21a18a2
children 10374:a83233559253
files plugins/muc/register.lib.lua spec/scansion/muc_register.scs
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/muc/register.lib.lua	Sat Nov 02 13:24:33 2019 +0100
+++ b/plugins/muc/register.lib.lua	Sat Nov 02 14:22:06 2019 +0100
@@ -53,7 +53,7 @@
 
 local registration_form = dataforms.new {
 	{ name = "FORM_TYPE", type = "hidden", value = "http://jabber.org/protocol/muc#register" },
-	{ name = "muc#register_roomnick", type = "text-single", label = "Nickname"},
+	{ name = "muc#register_roomnick", type = "text-single", required = true, label = "Nickname"},
 };
 
 local function enforce_nick_policy(event)
--- a/spec/scansion/muc_register.scs	Sat Nov 02 13:24:33 2019 +0100
+++ b/spec/scansion/muc_register.scs	Sat Nov 02 14:22:06 2019 +0100
@@ -100,7 +100,9 @@
 				<field type='hidden' var='FORM_TYPE'>
 					<value>http://jabber.org/protocol/muc#register</value>
 				</field>
-				<field type='text-single' label='Nickname' var='muc#register_roomnick'/>
+				<field type='text-single' label='Nickname' var='muc#register_roomnick'>
+					<required/>
+				</field>
 			</x>
 		</query>
 	</iq>
@@ -339,7 +341,9 @@
 				<field type='hidden' var='FORM_TYPE'>
 					<value>http://jabber.org/protocol/muc#register</value>
 				</field>
-				<field type='text-single' label='Nickname' var='muc#register_roomnick'/>
+				<field type='text-single' label='Nickname' var='muc#register_roomnick'>
+					<required/>
+				</field>
 			</x>
 		</query>
 	</iq>