# HG changeset patch # User Matthew Wild # Date 1601912706 -3600 # Node ID 3a03ae9a088256c94c7b50cad8507ac683ea262d # Parent 7678b4880719e89f70c7a3bd921edf0ec1d1ac66 mod_invites_register_web: Support linking to a web chat after successful registration diff -r 7678b4880719 -r 3a03ae9a0882 mod_invites_register_web/README.markdown --- a/mod_invites_register_web/README.markdown Thu Oct 01 17:51:32 2020 +0200 +++ b/mod_invites_register_web/README.markdown Mon Oct 05 16:45:06 2020 +0100 @@ -37,6 +37,10 @@ There is no specific configuration for this module (though it uses the optional `site_name` to override the displayed site name. +You may also set `webchat_url` to the URL of a web chat that will be linked +to after successful registration. If not specified but mod_conversejs is loaded +on the current host, it will default to the URL of that module. + This module depends on mod_invites_page solely for the case where an invalid invite token is received - it will redirect to mod_invites_page so that an appropriate error can be served to the user. diff -r 7678b4880719 -r 3a03ae9a0882 mod_invites_register_web/html/register_success.html --- a/mod_invites_register_web/html/register_success.html Thu Oct 01 17:51:32 2020 +0200 +++ b/mod_invites_register_web/html/register_success.html Mon Oct 05 16:45:06 2020 +0100 @@ -45,6 +45,16 @@

To start chatting, you need to enter your new account credentials into your chosen XMPP software.

+ {webchat_url& +
+

You can also use our online web chat to get started + right away. +

+ Log in via web +
+ } + +

As a final reminder, your account details are shown below:

diff -r 7678b4880719 -r 3a03ae9a0882 mod_invites_register_web/mod_invites_register_web.lua --- a/mod_invites_register_web/mod_invites_register_web.lua Thu Oct 01 17:51:32 2020 +0200 +++ b/mod_invites_register_web/mod_invites_register_web.lua Mon Oct 05 16:45:06 2020 +0100 @@ -1,6 +1,7 @@ local id = require "util.id"; local http_formdecode = require "net.http".formdecode; local usermanager = require "core.usermanager"; +local modulemanager = require "core.modulemanager"; local nodeprep = require "util.encodings".stringprep.nodeprep; local st = require "util.stanza"; local url_escape = require "util.http".urlencode; @@ -14,6 +15,14 @@ local site_name = module:get_option_string("site_name", module.host); local site_apps = module:shared("register_apps/apps"); +local webchat_url = module:get_option_string("webchat_url"); + +-- If not provided, but mod_conversejs is loaded, default to that +if not webchat_url and modulemanager.get_modules_for_host(module.host):contains("conversejs") then + local conversejs = module:depends("conversejs"); + webchat_url = conversejs.module:http_url(); +end + module:depends("http"); local invites = module:depends("invites"); @@ -166,6 +175,7 @@ domain = module.host; password = password; app = app_info; + webchat_url = webchat_url; }); else local err_id = id.short();