Changeset

343:0d8fb22404c3

plugins.register: Support submitting email when registering an account
author Matthew Wild <mwild1@gmail.com>
date Sat, 08 Jun 2013 18:17:09 +0100
parents 342:7aed4bc4949c
children 344:ea668c47e1bd
files plugins/register.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/register.lua	Sat Jun 08 17:43:41 2013 +0100
+++ b/plugins/register.lua	Sat Jun 08 18:17:09 2013 +0100
@@ -5,11 +5,14 @@
 function verse.plugins.register(stream)
 	local function handle_features(features_stanza)
 		if features_stanza:get_child("register", "http://jabber.org/features/iq-register") then
-			stream:send_iq(verse.iq({ to = stream.host_, type = "set" })
+			local request = verse.iq({ to = stream.host_, type = "set" })
 				:tag("query", { xmlns = xmlns_register })
 					:tag("username"):text(stream.username):up()
-					:tag("password"):text(stream.password):up()
-			, function (result)
+					:tag("password"):text(stream.password):up();
+			if stream.register_email then
+				request:tag("email"):text(stream.register_email):up();
+			end
+			stream:send_iq(request, function (result)
 				if result.attr.type == "result" then
 					stream:event("registration-success");
 				else