Registration with verification fails in 4.2.1
In TWiki::UI::Register.pm, line 1195, it says:
throw Error::Simple("bad code") unless $code =~ /^(\w+)\.(\d+)$/;
but the verification code contains characters, so the (\d+) fails.
The reason is the password function that is used to generate random passwords used to return only numbers (why?) but now returns a wider range of printable characters, including dots. note that this can also result in an illegal filename for the verification code file.
The password function should never have been used for this application. The verification code should have been generated using a random number generator. The following patch cures the problem.
Index: lib/TWiki/UI/Register.pm
===================================================================
--- lib/TWiki/UI/Register.pm (revision 17344)
+++ lib/TWiki/UI/Register.pm (working copy)
@@ -379,7 +379,7 @@
require TWiki::Users;
$data->{VerificationCode} =
- $data->{WikiName}.'.'.TWiki::Users::randomPassword();
+ $data->{WikiName}.'.'.int(rand(99999999));
require Data::Dumper;
--
TWiki:Main/CrawfordCurrie - 06 Aug 2008
unit tests need updating - doing now.
--
SvenDowideit - 09 Aug 2008