Software /
code /
prosody-modules
Changeset
4167:3a03ae9a0882
mod_invites_register_web: Support linking to a web chat after successful registration
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 05 Oct 2020 16:45:06 +0100 |
parents | 4166:7678b4880719 |
children | 4168:7191d4638393 |
files | mod_invites_register_web/README.markdown mod_invites_register_web/html/register_success.html mod_invites_register_web/mod_invites_register_web.lua |
diffstat | 3 files changed, 24 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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.
--- 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 @@ <p>To start chatting, you need to enter your new account credentials into your chosen XMPP software.</p> + {webchat_url& + <div class="alert alert-success"> + <p>You can also use our online web chat to get started + right away. + </p> + <a class="btn btn-primary" href="{webchat_url}">Log in via web</a> + </div> + } + + <p>As a final reminder, your account details are shown below:</p> <form class="account-details col-12 col-lg-6 mx-auto">
--- 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();