• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.

Item5894: User registration fails (verification code mismatch in Users.pm and Register.pm)

Item Form Data

AppliesTo: Component: Priority: CurrentState: WaitingFor: TargetRelease ReleasedIn
Engine Registration/Verification Normal No Action Required   n/a  

Edit Form Data

Summary:
Reported By:
Codebase:
Applies To:
Component:
Priority:
Current State:
Waiting For:
Target Release:
Released In:
 

Detail

In my fresh install of 4.2.1 user registration fails, if verification by email is enabled. After filling in and submitting TWiki/TWikiRegistration the server aborts with

bad code at /var/www/twiki/lib/TWiki/UI/Register.pm line 1195

I think this is caused by a mismatch in the verification code definitions in TWiki::Users::randomPassword and TWiki::UI::Register::_codeFile

lib/TWiki/Users.pm (sub randomPassword, Line 316)

join("", (".", "/", 0..9, "A".."Z", "a".."z")[rand(64), rand(64), rand(64), rand(64), rand(64), rand(64), rand(64), rand(64)]);

This creates a random string of eight characters, digits, "." and "/". This string is appended to the registrant's WikiName as part of the verification code in TWiki::UI::Register::_requireVerification (line 381-382). A subsequent check of this verification code in TWiki::UI::Register::_codeFile (line 1195), on the other hand, expects a digits-only random string and throws an error.

lib/TWiki/UI/Register.pm (sub _codeFile, Line 1195)

throw Error::Simple("bad code") unless $code =~ /^(\w+)\.(\d+)$/;

To work around this, I changed line 1195 to match the verification code generated in "randomPassword":

throw Error::Simple("bad code") unless $code =~ /^(\w+)\.([\.\/0-9A-Za-z]{8})$/;

This solved my problem. (As a side note: I'm not sure whether "/" should be included in a character class which is used to construct a random filename.)

Environment: Fresh test install of Debian Etch + TWiki-4.2.1.tgz:

  • TWiki version TWiki-4.2.1, Sun, 03 Aug 2008, build 17311, Plugin API version 1.2
  • Debian Etch
  • Apache 2.2
  • Perl 5.8.8

-- TWiki:Main/RainerFink - 06 Aug 2008

Duplicate of Item5892

-- CrawfordCurrie - 06 Aug 2008

ItemTemplate
Summary User registration fails (verification code mismatch in Users.pm and Register.pm)
ReportedBy TWiki:Main.RainerFink
Codebase 4.2.1
SVN Range TWiki-5.0.0, Sun, 03 Aug 2008, build 17280
AppliesTo Engine
Component Registration/Verification
Priority Normal
CurrentState No Action Required
TargetRelease n/a
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2008-08-06 - CrawfordCurrie
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback