How can I manually approve registrations?

You have installed Foswiki, and the site is running nicely. However everyone and his uncle is registering on your site, including some "undesireables". How can you set up Foswiki so you can manually filter registrations?

Assuming your Foswiki is already set up to require email confirmation of registrations, then this can be done by simply by redirecting the confirmation request email to the administrator, instead of to the requester, and changing some strings in the messages that the person registering (the requester) sees.

Step One: the confirmation mail

The email that gets sent to the person wanting to register is defined in a template. It is located in templates/registerconfirm.tmpl.

The first few lines of this says:
%{ This is a default template }%From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
To: %FIRSTLASTNAME% <%EMAILADDRESS%>
BCC: %WIKIWEBMASTER%
Subject: %MAKETEXT{"How to activate your [_1] registration" args="%WIKITOOLNAME%"}%

If you remove delete the To: line and change the BCC line to a To: it will be the WIKIWEBMASTER who receives the request to confirm the registration.

To make it more elegant, you could also change the content of the email so the administrator would get a proper email with information about the requester.

The entire template could look like this (without the MAKETEXT, assuming your tailored version is written in the language of your choice).
%{ This is a default template }%From: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
To: %WIKIWEBMASTERNAME% <%WIKIWEBMASTER%>
Subject: Registration request on %WIKITOOLNAME% for %FIRSTLASTNAME%, %EMAILADDRESS%
MIME-Version: 1.0
Content-Type: text/plain; charset=%CHARSET%
Content-Transfer-Encoding: 8bit

User %FIRSTLASTNAME%, %EMAILADDRESS% has requested registration on %WIKITOOLNAME%

To approve the registration, click %SCRIPTURL{"register"}%?action=verify;code=%VERIFICATIONCODE%
%X% Note: when you confirm a registration, it will log you in as that user at the same time. Don't forget to log that user out again!

To reject the registration, send an email to mail:%EMAILADDRESS%, or simply ignore the request.

Step Two: The message to the requester

The requester will be guided to a web page where he must enter the verification code. We need to change this to a message saying that their request requires approval.

This screen is defined as a message in the file templates/messages.tmpland looks like this:
%TMPL:DEF{"confirm"}%
---+++ %MAKETEXT{"Thank you for registering"}%

%MAKETEXT{"Your activation code has been sent to [_1].  Either click on the link in your e-mail or enter the code in the box below to activate your membership. (This code is of the form \"YourName.xxxxxxxxxx\")" args="%PARAM1%"}%

<form action="%SCRIPTURLPATH{"register"}%" method="post">
<input type="hidden" name="action" value="verify" size="20" />
<input type="text" name="code" size="20" />
<input type="submit" class="foswikiSubmit" value=' %MAKETEXT{"Submit"}% ' />
</form>
%TMPL:END%

We can change this to something like:
%TMPL:DEF{"confirm"}%
---+++ %MAKETEXT{"Thank you for registering"}%

Your request has been sent to the administrator who will normally approve your registration within 1-2 working days.
%TMPL:END%

And you are done.

ALERT! Remember:

Both the messages.tmpl and the registerconfirm.tmpl will be overwritten when you upgrade Foswiki. So make sure that you

  • Have copies of the modified files in a safe place
  • Keep a document with a complete list of all the tailoring you have done on your site. This will help you when you upgrade. You cannot remember what you have done just a few weeks after. Keeping a list of the changes and the files changed will make it easy to remove the files or modify the files when you upgrade.
This has been field-tested as described in Question121

-- KennethLavrsen, KiltBear, CrawfordCurrie

To-do: confirm you don't need to overwrite default registerconfirm.tmpl - because I'm pretty sure it obeys skin path settings.

-- PaulHarvey - 03 Mar 2010

A slightly different approach which I use in a situation where I need ordinary (non-admin) wiki users to approve new users into their groups by themselves (Eg. recruiting and immediately granting access for collaborators from conferences) is described at BestPracticeTip26

-- PaulHarvey - 03 Mar 2012

See also 'Manually approving Registrations' in http://foswiki.org/System/ManagingUsers#Authentication_and_Access_Control

which seems to be slightly more recent than the main text above, and walks you through the necessary template changes.

-- JamesWhitby - 27 Dec 2012

NB also that if following the examples above or in 'Manually approving registrations' where reference is made to a couple of days to respond to the registration request, then {Sessions}{ExpireAfter} should also be changed in the config (under Security and Authentiation/Sessions) from the default of 216000 s to something longer, or a negative number.

-- JamesWhitby - 04 Jan 2013

Support.FAQForm edit

TopicClassification FrequentlyAskedQuestion
Subject Registration or Authentication or Authorisation
Topic Summary You have installed Foswiki, and the site is running nicely. However everyone and his uncle is registering on your site, including some "undesireables". How can you set up Foswiki so you can manually filter registrations?
Extension
Interested Parties
Related Topics BestPracticeTip26
Topic revision: r7 - 04 Jan 2013, JamesWhitby
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy