--- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:21:59 2004 +++ ../bin/manage Sat Oct 23 16:56:38 2004 @@ -75,8 +75,13 @@ my ( $topic, $webName ) = TWiki::initialize( $thePathInfo, $wikiName, $topicName, $theUrl, $query ); - TWiki::UI::Manage::changePassword( $webName, $topic, $query ); + TWiki::UI::Register::changePassword( $webName, $topic, $query ); +} elsif ($action eq 'bulkRegister') { + use TWiki::UI::Register; + TWiki::UI::Register::bulkRegister( + query => $query, + ); } elsif( $action eq "deleteUserAccount" ) { my $wikiName = $query->param( 'username' ); --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:21:59 2004 +++ ../bin/passwd Sat Oct 23 16:56:47 2004 @@ -4,6 +4,7 @@ # # Copyright (C) 2000-2003 Peter Thoeny, Peter@Thoeny.com # Copyright (C) 2001 Klaus Wriessnegger, kw@sap.com +# Copyright (C) 2004 Martin Cleaver, Martin.Cleaver@BCS.org.uk # # For licensing info read license.txt file in the TWiki root. # This program is free software; you can redistribute it and/or @@ -18,25 +19,6 @@ # http://www.gnu.ai.mit.edu/copyleft/gpl.html # -#NOTE: the reset code is in this script because it needs to be in an un-authenticated -# script (see the .htaccess file) -# the matching InstallPassword code is protected, but still risky (anyone who has a valid -# htpasswd entry can call it by hand - -#usage example: -# -# -#R e s e t -# -#
-#Username
-#New password -#retype New password -# -# -# -# - BEGIN { # Set default current working directory @@ -51,12 +33,12 @@ use CGI::Carp qw(fatalsToBrowser); use CGI; use TWiki; -use TWiki::User; -use TWiki::User::HtPasswdUser; +use TWiki::UI::Register; +use Data::Dumper; -$query= new CGI; +$query = new CGI; -&main(); +main(); sub main { @@ -77,54 +59,18 @@ my ( $dummy1, $dummy2, $dummy3, $userName ) = &TWiki::initialize( $thePathInfo, $theRemoteUser, $topicName, $theUrl, $query ); - my $action = $query->param("installPasswd"); + my $action = $query->param("action"); + +# die Dumper($query); +# die $action; -if ( $action eq "requestReset" ) { - showEncryptedPasswd ($webName, $topic); + if ( $action eq "resetPassword" ) { + TWiki::UI::Register::resetPassword( + query => $query + ); } else { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsmanage"); - TWiki::redirect( $query, $url ); + $url = &TWiki::getOopsUrl( $webName, $topic, "oopsmanage"); + TWiki::redirect( $query, $url ); } } -#============================================== -# ($webName, $topic) -sub showEncryptedPasswd -{ - my ($webName, $topic) = @_; - - # get all parameters from the form - my $wikiName = $query->param( 'username' ); - my $passwordA = $query->param( 'password' ); - my $passwordB = $query->param( 'passwordA' ); - - my $url = ""; - - # check if required fields are filled in - if( ! $wikiName || ! $passwordA ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregrequ", ); - TWiki::redirect( $query, $url ); - return; - } - - # check if user entry exists - if( ( $wikiName ) && (! TWiki::User::UserPasswordExists( $wikiName ) ) ) { - # PTh 20 Jun 2000: changed to getOopsUrl - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsnotwikiuser", $wikiName ); - TWiki::redirect( $query, $url ); - return; - } - - # check if passwords are identical - if( $passwordA ne $passwordB ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregpasswd" ); - TWiki::redirect( $query, $url ); - return; - } - - my $theCryptPassword = &TWiki::User::HtPasswdUser::_htpasswdGeneratePasswd( $wikiName, $passwordA ); - - # and finally display the reset password page - $url = &TWiki::getOopsUrl( $webName, $wikiName, "oopsresetpasswd", $wikiName.":".$theCryptPassword ); - TWiki::redirect( $query, $url ); -} --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:21:59 2004 +++ ../bin/register Sat Oct 23 16:56:56 2004 @@ -3,6 +3,8 @@ # TWiki Collaboration Platform, http://TWiki.org/ # # Copyright (C) 1999-2004 Peter Thoeny, peter@thoeny.com +# (C) 2001 Kevin Atkinson, kevin twiki at atkinson dhs org +# (C) 2004 Martin Cleaver, Martin.Cleaver@BCS.org.uk # # For licensing info read license.txt file in the TWiki root. # This program is free software; you can redistribute it and/or @@ -29,201 +31,75 @@ # I18N: No locale settings necessary yet - only 7-bit ASCII due # to Apache limitations on userids. +my $tempUserDir = TWiki::getPubDir()."/TWiki/RegistrationApprovals"; # SMELL hacked name, and +#stores in binary format! +my $sendActivationCode = 1; +my $needApproval = 1; +use strict; use CGI::Carp qw(fatalsToBrowser); use CGI; use TWiki; -use TWiki::Net; -use TWiki::Plugins; -use TWiki::User; - -&main(); - -sub main -{ - my $query = new CGI; - - # get all parameters from the form - my @paramNames = $query->param(); - my @formDataName = (); - my @formDataValue = (); - my @formDataRequired = (); - my $name = ""; - my $value = ""; - my $emailAddress = ""; - my $firstLastName = ""; - my $wikiName = ""; - my $remoteUser = ""; - my $passwordA = ""; - my $passwordB = ""; - - foreach( @paramNames ) { - if( /^(Twk)([0-9])(.*)/ ) { - $value = $query->param( "$1$2$3" ); - $formDataRequired[@formDataRequired] = $2; - $name = $3; - # TODO: I18N fix here ??? - $name =~ s/([a-z0-9])([A-Z0-9])/$1 $2/go; # Space the names - $name =~ s/(AIM)(Screen)/$1 $2/go; # Horrible hack to space AIMScreen - $formDataName[@formDataName] = $name; - $formDataValue[@formDataValue] = $value; - - if( $name eq "Name" ) { - $firstLastName = $value; - } elsif( $name eq "Wiki Name" ) { - $wikiName = $value; - } elsif( $name eq "Login Name" ) { - $remoteUser = $value; - } elsif( $name eq "Email" ) { - $emailAddress = $value; - } elsif( $name eq "Password" ) { - $passwordA = $value; - } elsif( $name eq "Confirm" ) { - $passwordB = $value; - } - } - } - my $formLen = @formDataValue; - - my $topicName = $query->param( 'TopicName' ); - my $thePathInfo = $query->path_info(); - my $theUrl = $query->url; - ( $topic, $webName ) = - &TWiki::initialize( $thePathInfo, $wikiName, $topicName, $theUrl, $query ); - - my $text = ""; - my $url = ""; - - # check if user entry already exists - if( ( $wikiName ) - && ( ( &TWiki::Store::topicExists( $webName, $wikiName ) ) - || ( TWiki::User::UserPasswordExists( $wikiName ) ) - ) ) { - # PTh 20 Jun 2000: changed to getOopsUrl - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregexist", $wikiName ); - TWiki::redirect( $query, $url ); - return; - } - - # check if required fields are filled in - my $x; - for( $x = 0; $x < $formLen; $x++ ) { - if( ( $formDataRequired[$x] ) && ( ! $formDataValue[$x] ) ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregrequ", ); - TWiki::redirect( $query, $url ); - return; - } - } - - # check if wikiName is a WikiName - if( ! &TWiki::isWikiName( $wikiName ) ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregwiki" ); - TWiki::redirect( $query, $url ); - return; - } - - # a WikiName is safe, so untaint variable - $wikiName =~ /(.*)/; - $wikiName = $1; - - # check if passwords are identical - if ( $passwordA ne $passwordB ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregpasswd" ); - TWiki::redirect( $query, $url ); - return; - } - - # check valid email address - if( $emailAddress !~ $TWiki::regex{emailAddrRegex} ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregemail" ); - TWiki::redirect( $query, $url ); - return; - } - - - # everything OK - - # generate user entry and add to .htpasswd file - unless( $remoteUser ) { - if ( ! TWiki::User::AddUserPassword($wikiName, $passwordA ) ) { - $url = &TWiki::getOopsUrl( $webName, $topic, "oopsregerr" ); - TWiki::redirect( $query, $url ); - return; - } - } +use TWiki::UI::Register; +use Storable; - # send email confirmation - my $skin = $query->param( "skin" ) || TWiki::Prefs::getPreferencesValue( "SKIN" ); - $text = TWiki::Store::readTemplate( "registernotify", $skin ); - $text =~ s/%FIRSTLASTNAME%/$firstLastName/go; - $text =~ s/%WIKINAME%/$wikiName/go; - $text =~ s/%EMAILADDRESS%/$emailAddress/go; - ( $before, $after) = split( /%FORMDATA%/, $text ); - for( $x = 0; $x < $formLen; $x++ ) { - $name = $formDataName[$x]; - $value = $formDataValue[$x]; - if( ( $name eq "Password" ) && ( $TWiki::doHidePasswdInRegistration ) ) { - $value = "*******"; - } - if( $name ne "Confirm" ) { - $before .= " * $name\: $value\n"; - } - } - $text = "$before$after"; - $text = &TWiki::handleCommonTags( $text, $wikiName ); - $text =~ s/( ?) *<\/?(nop|noautolink)\/?>\n?/$1/gois; # remove and tags - - my $senderr = &TWiki::Net::sendEmail( $text ); - - # create user topic if it does not exist - if( ! &TWiki::Store::topicExists( $TWiki::mainWebname, $wikiName ) ) { - my $meta = ""; - my $row = ""; - ( $meta, $text ) = &TWiki::Store::readTemplateTopic( "NewUserTemplate" ); - $text = "%SPLIT%\n\t* %KEY%: %VALUE%%SPLIT%\n" unless $text; - ( $before, $repeat, $after) = split( /%SPLIT%/, $text ); - for( $x = 0; $x < $formLen; $x++ ) { - $name = $formDataName[$x]; - $value = $formDataValue[$x]; - $value =~ s/[\n\r]/ /go; - if( ! ( ( $name eq "Wiki Name" ) - || ( $name eq "Password" ) - || ( $name eq "Confirm" ) ) ) { - $row = $repeat; - $row =~ s/%KEY%/$name/go; - $row =~ s/%VALUE%/$value/go; - $before .= $row; - } - } - $text = "$before$after"; +# Register -> Verify -> Approve -> Finish - my $userName = $remoteUser || $wikiName; - $text = TWiki::expandVariablesOnTopicCreation( $text, $userName, $wikiName, "$webName.$wikiName" ); +my $query = new CGI; +# NB. bulkRegister is in ManageCgiScript. - $meta->put( "TOPICPARENT", ( "name" => $TWiki::wikiUsersTopicname ) ); - &TWiki::Store::saveTopic( $webName, $wikiName, $text, $meta, "", 1 ); +my $action = $query->param('action'); + +if ($action eq 'register') { + TWiki::UI::Register::register( + query => $query, + sendActivationCode => $sendActivationCode, + tempUserDir => $tempUserDir + ); + if (!$sendActivationCode) { + die "Need to call verify automatically"; + } +} elsif ($action eq 'approve') { + TWiki::UI::Register::finish( + query=>$query, + tempUserDir=>$tempUserDir + ); + + } +elsif ($action eq 'verify') { + TWiki::UI::Register::verifyEmailAddress( + query=>$query, + tempUserDir=>$tempUserDir, + needApproval=>$needApproval + ); +# if (! $needApproval) { +# die "Need to call approve automatically"; +# } + TWiki::UI::Register::finish( + query=>$query, + tempUserDir=>$tempUserDir, + approve=>$query->param('code') + ); + + } elsif ($action eq 'resetPassword') { #TODO + TWiki::UI::Register::resetPassword( + query => $query + ); + } else { + die "invalid action ($action) in register"; } - # Plugin callback to set cookies. Contrib by SvenDowideit - &TWiki::Plugins::registrationHandler( $webName, $wikiName, $remoteUser ); - # add user to TWikiUsers topic - my $userTopic = TWiki::User::addUserToTWikiUsersTopic( $wikiName, $remoteUser ); +# Output of register: +# UnsavedUser, accessible by username.$verificationCode - # write log entry - if( $TWiki::doLogRegistration ) { - &TWiki::Store::writeLog( "register", "$webName.$wikiName", $emailAddress, $wikiName ); - } +# Output of reset password: +# unaffected user, accessible by username.$verificationCode - if( $senderr ) { - my $url = &TWiki::getOopsUrl( $webName, $wikiName, "oopssendmailerr", $senderr ); - TWiki::redirect( $query, $url ); - } - - # and finally display thank you page - $url = &TWiki::getOopsUrl( $webName, $wikiName, "oopsregthanks", $emailAddress ); - TWiki::redirect( $query, $url ); -} +# Output of verify: +# UnsavedUser, accessible by username.$approvalCode (only sent to administrator) +# Output of approve: +# RegisteredUser, all related UnsavedUsers deleted # EOF --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:21:59 2004 +++ ../data/TWiki/ChangePassword.txt Sat Oct 23 16:57:08 2004 @@ -1,20 +1,20 @@ -%META:TOPICINFO{author="PeterThoeny" date="1071649860" format="1.0" version="1.8"}% -Change password -%STARTINCLUDE% - -__Forgot your old password?__ Then use ResetPassword instead. Please only use ResetPassword in case you really forgot your password. Thank you. - - -| Your %TWIKIWEB%.WikiName: | =**= | -| Old password: | =**= | -| New password: | =**= | -| Retype new password: | =**= | -|   |    (Fields marked =**= are required) | - - -After submitting this form your password will be changed. - -If you have questions please contact the TWiki webmaster %WIKIWEBMASTER%. - -%STOPINCLUDE% -__Note to administrator:__ The change password form applies only if TWiki uses Basic Authentication, e.g. a =.htpassword= file managed by TWiki. It does not apply if you are using external authentication, such as an IT managed password system. (remove this note if you are using Basic Authentication; else replace this topic with a note describing how to change the password in your organization) +%META:TOPICINFO{author="MartinCleaver" date="1098293694" format="1.0" version="1.11"}% +%STARTINCLUDE% + +__Forgotton your password?__ Then use ResetPassword instead. %MAINWEB%.TWikiUsers has a full list of user names. + +
+| Your %TWIKIWEB%.LoginName: | =**= | +| Old password: | =**= | +| New password: | =**= | +| Retype new password: | =**= | +|   |    (Fields marked =**= are required) | +
+ +After submitting this form your password will be changed. + +If you have questions please contact the TWiki webmaster %WIKIWEBMASTER%. + +%STOPINCLUDE% +__Note to administrator:__ The change password form applies only if TWiki uses Basic Authentication, e.g. a =.htpassword= file managed by TWiki. It does not apply if you are using external authentication, such as an IT managed password system. (remove this note if you are using Basic Authentication; else replace this topic with a note describing how to change the password in your organization) + --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/ManagingUsers.txt Sat Oct 23 16:57:25 2004 @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="PeterThoeny" date="1092557660" format="1.0" version="1.1"}% +%META:TOPICINFO{author="MartinCleaver" date="1098102230" format="1.0" version="1.2"}% %TOC% %STARTINCLUDE% ---# Manage Users @@ -12,12 +12,13 @@ ---++ Register User * TWikiRegistration is for users to fill out a form - * NewUserTemplate can be changed to customize user home pages + * NewUserTemplate can be changed to customize user home pages, it can optionally use the UserForm to define user fields as meta data + * BulkRegistration can be used to set up multiple accounts: either from a table or from an external file ---++ Change, Reset and Install Passwords * ChangePassword is for users who remember their password - * ResetPassword is for users who do _not_ remember their password; they are asked to send a request to the site administrator to install a new password + * ResetPassword is for users who do _not_ remember their password; a system generated password is emailed to them * InstallPassword is for the site administrator to install a password ---++ Removing User Accounts --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/NewUserTemplate.txt Sat Oct 23 16:57:32 2004 @@ -1,29 +1,28 @@ -%META:TOPICINFO{author="PeterThoeny" date="1092558634" format="1.0" version="1.7"}% +%META:TOPICINFO{author="TWikiGuest" date="1096832673" format="1.0" version="1.8"}% %SPLIT% * %KEY%: %VALUE%%SPLIT% -__My Links__ - * %TWIKIWEB%.WelcomeGuest to learn TWiki +If this is you, you can change text on this page - just try editing it. Any pictures you attach will also show. + +---++ About me + +---+++ Academic background + +---+++ Work background + +---+++ Interests + +---+++ Links * Sandbox.WebHome web to try out TWiki - * Sandbox.%TOPIC%Sandbox just for me - * - * - -__Personal Preferences (details in %TWIKIWEB%.TWikiVariables)__ - * Show tool-tip topic info on mouse-over of %TWIKIWEB%.WikiWord links, on or off: (see details in %TWIKIWEB%.%WIKIPREFSTOPIC%) - * Set LINKTOOLTIPINFO = off - * Horizontal size of text edit box: - * Set EDITBOXWIDTH = 70 - * Vertical size of text edit box: - * Set EDITBOXHEIGHT = 22 - * Style of text edit box. =width: 99%= for full window width (default), =width: auto= to disable. - * Set EDITBOXSTYLE = width: 99% + * Sandbox.%TOPIC%Sandbox is a topic for my experiments + +---+++ Feedback + +%INCLUDE{GuestBooks.%TOPIC%GuestBook}% + +---++ Personal Settings and Preferences (details in %TWIKIWEB%.TWikiVariables) * Optionally write protect your home page: (set it to your %TWIKIWEB%.WikiName) - * Set ALLOWTOPICCHANGE = + * Set ALLOWTOPICCHANGE = %WIKINAME% -__Related topics__ - * ChangePassword - * %TWIKIWEB%.%WIKIPREFSTOPIC% has site-level preferences of %WIKITOOLNAME%. - * %WEBPREFSTOPIC% has preferences of the %WIKITOOLNAME%.%WEB% web. - * %MAINWEB%.%WIKIUSERSTOPIC% has a list of other TWiki users. +%META:FORM{name="TWiki.UserForm"}% --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/ResetPassword.txt Sat Oct 23 16:57:36 2004 @@ -1,20 +1,22 @@ -%META:TOPICINFO{author="SvenDowideit" date="1071746139" format="1.0" version="1.7"}% +%META:TOPICINFO{author="MartinCleaver" date="1098280054" format="1.0" version="1.13"}% %META:TOPICPARENT{name="ChangePassword"}% -Request for reset of password
-%STARTINCLUDE% - -Please only use this *ResetPassword* form in case you really forgot your password. Otherwise just change it using ChangePassword. Thank you. - -
-| Your %TWIKIWEB%.WikiName: | =**= | -| New password: | =**= | -| Retype new password: | =**= | -|   |    (Fields marked =**= are required) | -
- -After submitting this form you will see a page with your *new password* appearing *encrypted*. - -You will have to e-mail this information to the Wiki webmaster, %WIKIWEBMASTER%, who will set your account to use the new password. - -%STOPINCLUDE% -__Note to administrator:__ The reset password form applies only if TWiki uses Basic Authentication, e.g. a =.htpassword= file managed by TWiki. It does not apply if you are using external authentication, such as an IT managed password system. (remove this note if you are using Basic Authentication; replace this topic with a note describing how to reset the password in your organization) +---++ Request reset password +%STARTINCLUDE% + +If you didn't forget your password, use ChangePassword to change it to a new one. Otherwise, use this form to get a new one emailed to you. Your LoginName is listed on %MAINWEB%.TWikiUsers. + +
+| Your %TWIKIWEB%.LoginName: | =**= | + + +
+ +After submitting this form, you will receive an email with your new, *system-generated* password, and a link to a page where you can change it. + +If you continue to have problems, please email %WIKIWEBMASTER% for help. + +%STOPINCLUDE% + + +__Note to administrator:__ The reset password form applies only if TWiki uses Basic Authentication, e.g. a =.htpassword= file managed by TWiki. It does not apply if you are using external authentication, such as an IT managed password system. (remove this note if you are using Basic Authentication; replace this topic with a note describing how to reset the password in your organization) + --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/TWikiRegistration.txt Mon Oct 25 14:14:57 2004 @@ -1,59 +1,46 @@ -%META:TOPICINFO{author="PeterThoeny" date="1043916483" format="1.0" version="1.8"}% -To edit pages on this %WIKITOOLNAME% Collaborative Web, you must have a registered user name in WikiNotation. - -To register as a new user, simply fill out this form: - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
First & last name: =**=
Your WikiName: =**=
Intranet login name: =**=
Email address: =**=
Phone:
Department: -
Office location: - =**= -
Comments :
(optional)  
     (Fields marked =**= are required)
-
- -__Submitting the form will automatically:__ - - * Create an account for you, so that you can start editing pages using your WikiName. - * Create your personal %WIKITOOLNAME% topic using your WikiName as topic name, and add the data you submitted to the topic. - * Add your name to the list of users in the %MAINWEB%.%WIKIUSERSTOPIC% topic in the %MAINWEB% web. - * Send you a confirmation of your registration by email. - - -Once registered you can login using your WikiName and password. - -If you have any questions about registration, send an email to %WIKIWEBMASTER%. +%META:TOPICINFO{author="mrjcleaver" date="1098738895" format="1.0" version="1.9"}% +To edit pages on this %WIKITOOLNAME% Collaborative Web, you must have a registered user name in WikiNotation. + +To register as a new user, simply fill out this form: + + + +
+ + + + + + + + + + + + + + + + + + + + + + +
First Name: =**=
Last Name: =**=
(identifies you to others) WikiName: =**=
(how you log in) LoginName: =**=
Email address: =**=
Comments :
(optional)  
  +    (Fields marked =**= are required)
+
+ +__Submitting the form will automatically:__ + + * Create an account for you, so that you can start editing pages using your WikiName. + * Create your personal %WIKITOOLNAME% topic using your WikiName as topic name, and add the data you submitted to the topic. + * Add your name to the list of users in the %MAINWEB%.%WIKIUSERSTOPIC% topic in the %MAINWEB% web. + * Send you a confirmation of your registration by email. + + +Once registered you can login using your WikiName and password. + +If you have any questions about registration, send an email to %WIKIWEBMASTER%. + --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/TWikiRegistrationPub.txt Mon Oct 25 14:12:28 2004 @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="PeterThoeny" date="1090790707" format="1.0" version="1.12"}% +%META:TOPICINFO{author="mrjcleaver" date="1098736857" format="1.0" version="1.13"}% To edit pages on this TWikiSite, you must have a registered user name and password. * %H% *NOTE:* You can also login anonymously as user *TWikiGuest* with password *guest*. @@ -11,11 +11,18 @@
- - + + + + + + + + + - - + + @@ -25,7 +32,8 @@ - + + @@ -180,7 +188,7 @@ - +
First & last name: =**= First Name: =**=
Last Name: =**=
(identifies you to others) WikiName: =**=
Your WikiName: =**= (how you log in) LoginName: =**=
Email address: =**=
Retype password: =**=
Company name:
Comments :
(optional)  
       (Fields marked =**= are required)
--- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../data/TWiki/WebLeftBar.txt Sat Oct 23 16:57:45 2004 @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="PeterThoeny" date="1092718938" format="1.0" version="1.2"}% +%META:TOPICINFO{author="MartinCleaver" date="1097951296" format="1.0" version="1.3"}% * *[[%WIKILOGOURL%][TWiki]]* * *[[%TWIKIWEB%.WelcomeGuest][Welcome]]* @@ -11,7 +11,7 @@ * [[WebIndex][Index]] * [[WebSearch][Search]] --- - * *TWiki Webs* + * *Webs* %WEBLIST{" * [[$name.%HOMETOPIC%][$name]]" separator=""}%
%INCLUDE{"%MAINWEB%.%WIKINAME%LeftBar" warn="Create personal sidebar"}% --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki.pm Sun Oct 24 09:02:05 2004 @@ -1033,34 +1033,10 @@ sub getEmailOfUser { my( $wikiName ) = @_; # WikiName without web prefix + # TODO: assert that it does not contain %MAINWEB% - my @list = (); - # Ignore guest entry and non-existent pages - if ( $wikiName ne "TWikiGuest" && - TWiki::Store::topicExists( $mainWebname, $wikiName ) ) { - if ( $wikiName =~ /Group$/ ) { - # Page is for a group, get all users in group - ##writeDebug "using group: $mainWebname . $wikiName"; - my @userList = TWiki::Access::getUsersOfGroup( $wikiName ); - foreach my $user ( @userList ) { - $user =~ s/^.*\.//; # Get rid of 'Main.' part. - foreach my $email ( getEmailOfUser($user) ) { - push @list, $email; - } - } - } else { - # Page is for a user - ##writeDebug "reading home page: $mainWebname . $wikiName"; - foreach ( split ( /\n/, &TWiki::Store::readWebTopic( - $mainWebname, $wikiName ) ) ) { - if (/^\s\*\sEmail:\s+([\w\-\.\+]+\@[\w\-\.\+]+)/) { - # Add email address to list - push @list, $1; - } - } - } - } - return (@list); + use TWiki::User; + return TWiki::User::getEmail($wikiName); } =pod @@ -1188,9 +1164,10 @@ Translates intranet username (e.g. jsmith) to WikiName (e.g. JaneSmith) userToWikiListInit must be called before this function is used. -Unless $dontAddWeb is set, "Main." is prepended to the returned WikiName. +Unless $flag is set, "Main." is prepended to the returned WikiName. -if you give an invalid username, we just return that (no appending Main. blindy) +if you give an invalid username, we just return that (no appending Main. blindy), +unless flag is set to 2, in which case it returns undef. SMELL: the userToWikiList cache should really contain the WebName so its possible to have userTopics in more than just the MainWeb (what if you move a user topic?) @@ -1199,18 +1176,34 @@ sub userToWikiName { - my( $loginUser, $dontAddWeb ) = @_; + my( $loginUser, $flag ) = @_; if( !$loginUser ) { return ""; } $loginUser =~ s/$securityFilter//go; - my $wUser = $userToWikiList{ $loginUser } || $loginUser; - if( $dontAddWeb ) { - return $wUser; + my $wUser = $userToWikiList{ $loginUser }; + + # New behaviour for RegisterCgiScriptRewrite + if ($flag && ($flag == 2)) { # return the real mapping, even if it is undef + return $wUser; } - return "$mainWebname.$wUser"; + + # Original behaviour - map existing entries + unless ($wUser) { + $wUser = $loginUser; + } + + # return with webName + unless ($flag) { + return "$mainWebname.$wUser"; + } + + # v2 - blindy return loginName if mapping not present. + return $wUser; + + } =pod --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/Store.pm Sat Oct 23 16:57:57 2004 @@ -1530,18 +1530,21 @@ while( $text =~ /%TMPL\:INCLUDE{[\s\"]*(.*?)[\"\s]*}%/s ) { $text =~ s/%TMPL\:INCLUDE{[\s\"]*(.*?)[\"\s]*}%/&_readTemplateFile( $1, $theSkin, $theWeb )/geo; } - +# die $text; if( ! ( $text =~ /%TMPL\:/s ) ) { # no template processing $text =~ s|^(( {3})+)|"\t" x (length($1)/3)|geom; # leading spaces to tabs return $text; } - +# die $text; my $result = ""; my $key = ""; my $val = ""; my $delim = ""; + my $count = 0; foreach( split( /(%TMPL\:)/, $text ) ) { + $count++; +# print "

$count

\n".$_."

".$text."
"; if( /^(%TMPL\:)$/ ) { $delim = $1; } elsif( ( /^DEF{[\s\"]*(.*?)[\"\s]*}%[\n\r]*(.*)/s ) && ( $1 ) ) { @@ -1565,13 +1568,41 @@ } else { $result .= "$delim$_"; } +# print "

$count



$key / $val / ".$result; +# print "
".Dumper(\%templateVars)."
"; +# print "
"; } +# diagnoseReadTemplate(\%templateVars, $result); +# die; # handle %TMPL:P{"..."}% recursively $result =~ s/%TMPL\:P{[\s\"]*(.*?)[\"\s]*}%/&handleTmplP($1)/geo; $result =~ s|^(( {3})+)|"\t" x (length($1)/3)|geom; # leading spaces to tabs + return $result; } + +=pod + +---++ diagnoseReadTemplate($templateVarsRef, $result) + +Call this to illustrate the state of the readTemplate sub + +=cut + +sub diagnoseReadTemplate { + my ($templateVarsRef, $result) = @_; + print "Content-type: text/html\n\n"; + use Data::Dumper; + + $Data::Dumper::Pad = " "; + print "
".Dumper($templateVarsRef)."


".$result."

"; + + unless ($result) { + print "Result was empty!
"; + } +} + =pod --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/Store/RcsFile.pm Sat Oct 23 16:58:01 2004 @@ -636,12 +636,17 @@ umask( 0 ); mkdir( $tempPath, 0775 ); } + + unless (-f $theTmpFilename) { + die "No such file $theTmpFilename"; + } # FIXME share with move - part of init? # save uploaded file my $newFile = $self->{file}; copy($theTmpFilename, $newFile) or warn "copy($theTmpFilename, $newFile) failed: $!"; + # FIXME more consistant way of dealing with errors umask( 002 ); chmod( 0644, $newFile ); # FIXME config permission for new attachment --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/UI/Manage.pm Tue Oct 26 04:23:01 2004 @@ -91,68 +91,6 @@ return; } -=pod - ----+++ changePassword( $webName, $topic, $query ) -Change the user's password. Details of the user and password -are passed in CGI parameters. -| =username= | | -| =password= | | -| =passwordA= | | -| =TopicName= | | - -=cut - -sub changePassword { - my( $webName, $topic, $query ) = @_; - - my $wikiName = $query->param( 'username' ); - my $passwordA = $query->param( 'password' ); - my $passwordB = $query->param( 'passwordA' ); - my $topicName = $query->param( 'TopicName' ); - - # check if required fields are filled in - if( ! $wikiName || ! $passwordA ) { - TWiki::UI::oops( $webName, $topic, "regrequ", ); - return; - } - - # check if user entry exists - #TODO: need to handle the NoPasswdUser case (UserPasswordExists will retun false here) - if( ( $wikiName ) && (! TWiki::User::UserPasswordExists( $wikiName ) ) ) { - TWiki::UI::oops( $webName, $topic, "notwikiuser", $wikiName ); - return; - } - - # check if passwords are identical - if( $passwordA ne $passwordB ) { - TWiki::UI::oops( $webName, $topic, "regpasswd" ); - return; - } - - # c h a n g e - my $oldpassword = $query->param( 'oldpassword' ); - - # check if required fields are filled in - if( ! $oldpassword ) { - TWiki::UI::oops( $webName, $topic, "regrequ" ); - return; - } - - my $pw = TWiki::User::CheckUserPasswd( $wikiName, $oldpassword ); - if( ! $pw ) { - # NO - wrong old password - TWiki::UI::oops( $webName, $topic, "wrongpassword"); - return; - } - - # OK - password may be changed - TWiki::User::UpdateUserPassword($wikiName, $oldpassword, $passwordA ); - - # OK - password changed - TWiki::UI::oops( $webName, $topic, "changepasswd" ); -} - # PRIVATE Prepare a template var for expansion in a message sub _template { my $theTmplVar = shift; --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/UI/Oops.pm Sat Oct 23 16:58:12 2004 @@ -44,6 +44,7 @@ my $tmplName = $query->param( 'template' ) || "oops"; my $skin = $query->param( "skin" ) || TWiki::Prefs::getPreferencesValue( "SKIN" ); my $tmplData = TWiki::Store::readTemplate( $tmplName, $skin ); + if( ! $tmplData ) { TWiki::writeHeader( $query ); print "\n" --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/User.pm Sat Oct 23 16:58:18 2004 @@ -58,9 +58,9 @@ # FIXME: Move elsewhere? # template variable hash: (built from %TMPL:DEF{"key"}% ... %TMPL:END%) -use vars qw( %templateVars $UserImpl ); # init in TWiki.pm so okay for modPerl +use vars qw( %templateVars $PasswordImpl ); # init in TWiki.pm so okay for modPerl -$UserImpl = ""; +$PasswordImpl = ""; # =========================== =pod @@ -74,34 +74,34 @@ %templateVars = (); if ( # (-e $TWiki::htpasswdFilename ) && #<<< maybe ( $TWiki::htpasswdFormatFamily eq "htpasswd" ) ) { - $UserImpl = "TWiki::User::HtPasswdUser"; + $PasswordImpl = "TWiki::User::HtPasswdUser"; # } elseif ($TWiki::htpasswdFormatFamily eq "something?") { -# $UserImpl = "TWiki::User::SomethingUser"; +# $PasswordImpl = "TWiki::User::SomethingUser"; } else { - $UserImpl = "TWiki::User::NoPasswdUser"; + $PasswordImpl = "TWiki::User::NoPasswdUser"; } - eval "use ".$UserImpl; + eval "use ".$PasswordImpl; } # =========================== =pod ----++ sub _getUserHandler ( $web, $topic, $attachment ) +---++ sub _getPasswordHandler ( $web, $topic, $attachment ) Not yet documented. =cut -sub _getUserHandler +sub _getPasswordHandler { my( $web, $topic, $attachment ) = @_; $attachment = "" if( ! $attachment ); - my $handlerName = $UserImpl; + my $passwordHandlerName = $PasswordImpl; - my $handler = $handlerName->new( ); - return $handler; + my $passwordHandler = $passwordHandlerName->new( ); + return $passwordHandler; } #========================= @@ -119,9 +119,9 @@ { my ( $user ) = @_; - my $handler = _getUserHandler(); + my $passwordHandler = _getPasswordHandler(); - return $handler->UserPasswordExists($user); + return $passwordHandler->UserPasswordExists($user); } #========================= @@ -147,8 +147,8 @@ return; } - my $handler = _getUserHandler(); - return $handler->UpdateUserPassword($user, $oldUserPassword, $newUserPassword); + my $passwordHandler = _getPasswordHandler(); + return $passwordHandler->UpdateUserPassword($user, $oldUserPassword, $newUserPassword); } #========================= @@ -173,8 +173,8 @@ return; } - my $handler = _getUserHandler(); - return $handler->AddUserPassword($user, $newUserPassword); + my $passwordHandler = _getPasswordHandler(); + return $passwordHandler->AddUserPassword($user, $newUserPassword); } #========================= @@ -192,8 +192,8 @@ { my ( $user ) = @_; - my $handler = _getUserHandler(); - return $handler->RemoveUser($user); + my $passwordHandler = _getPasswordHandler(); + return $passwordHandler->RemoveUser($user); } # ========================= @@ -212,8 +212,8 @@ { my ( $user, $password ) = @_; - my $handler = _getUserHandler(); - return $handler->CheckUserPasswd($user, $password); + my $passwordHandler = _getPasswordHandler(); + return $passwordHandler->CheckUserPasswd($user, $password); } # ========================= @@ -230,6 +230,8 @@ sub addUserToTWikiUsersTopic { +# use Data::Dumper; +# die Dumper(\@_); my ( $wikiName, $remoteUser ) = @_; my $today = &TWiki::formatTime(time(), "\$day \$mon \$year", "gmtime"); my $topicName = $TWiki::wikiUsersTopicname; @@ -281,7 +283,73 @@ return $topicName; } +sub getEmail { + my ($wikiName) = @_; + my $mainWebname = $TWiki::mainWebname; + + # Ignore guest entry and non-existent pages + unless (TWiki::Store::topicExists( $mainWebname, $wikiName )) { + return; + } + + if ($wikiName eq "TWikiGuest") { + return; + } + + my @list = (); + + if ( $wikiName =~ /Group$/ ) { + # Page is for a group, get all users in group + ##writeDebug "using group: $mainWebname . $wikiName"; + my @userList = TWiki::Access::getUsersOfGroup( $wikiName ); + foreach my $user ( @userList ) { + $user =~ s/^.*\.//;# Get rid of 'Main.' part. + foreach my $email ( TWiki::getEmailOfUser($user) ) { + push @list, $email; + } + } + } else { + # Page is for a user + ##writeDebug "reading home page: $mainWebname . $wikiName"; + push @list, getEmailAddressesFromPage($mainWebname, $wikiName); + } + use Data::Dumper; + return (@list); +} + +=pod +Returns the email addresses bulletfield / metafield on the page +Each should be handled by separate implementation classes. + +=cut + +sub getEmailAddressesFromPage { + my ($mainWebname, $wikiName) = @_; + my @emailAddresses = (); + +# die Dumper(\@_); + foreach ( + split ( /\n/, + TWiki::Store::readWebTopic( + $mainWebname, + $wikiName ) + ) + ) + { + # REFACTOR UserData::BulletFieldsImpl + if (/^\s\*\sEmail:\s+([\w\-\.\+]+\@[\w\-\.\+]+)/) { + # Add email address to list + push @emailAddresses, $1; + } + + # REFACTOR UserData::MetaFieldsImpl + if (/^\%META\:FIELD\{name="Email"(.*?)value="(.*)"\}%/) { + push @emailAddresses, $2; + } + } + return @emailAddresses; +} 1; --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../lib/TWiki/User/HtPasswdUser.pm Sat Oct 23 16:58:29 2004 @@ -283,7 +283,8 @@ my ( $self, $user ) = @_; my $userEntry = $user.":"._htpasswdReadPasswd( $user ); - return $self->htpasswdUpdateUser( $userEntry, "#".$userEntry); + return $self->htpasswdUpdateUser( $userEntry, "" ); +#"#".$userEntry } # ========================= @@ -303,6 +304,7 @@ my $currentEncryptedPasswordEntry = _htpasswdReadPasswd( $user ); my $encryptedPassword = _htpasswdGeneratePasswd($user, $password , 1); +# die "current = $currentEncryptedPasswordEntry; new = $encryptedPassword"; # OK if( $encryptedPassword eq $currentEncryptedPasswordEntry ) { --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../templates/oopsnotwikiuser.tmpl Sat Oct 23 16:58:35 2004 @@ -1,12 +1,11 @@ %TMPL:INCLUDE{"twiki"}% %TMPL:DEF{"titleaction"}%(oops) %TMPL:END% %TMPL:DEF{"webaction"}% *Attention* %TMPL:END% -%TMPL:DEF{"heading"}%You are not registered%TMPL:END% +%TMPL:DEF{"heading"}%No such Login %TMPL:END% %TMPL:DEF{"message"}% Can't find the username %PARAM1%. -Make sure you spelled the User Name correctly and try again. -Remember, a %TWIKIWEB%.WikiName is case sensitive. +Please make sure you spelled the %TWIKIWEB%.LoginName correctly and try again. If you get stuck, please mail %WIKIWEBMASTER%. See %MAINWEB%.TWikiUsers for a list of existing users or register as new user in %TWIKIWEB%.TWikiRegistration. %TMPL:END% --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../templates/oopsregexist.tmpl Sat Oct 23 16:58:41 2004 @@ -3,10 +3,13 @@ %TMPL:DEF{"webaction"}% *Attention* %TMPL:END% %TMPL:DEF{"heading"}%You are already registered%TMPL:END% %TMPL:DEF{"message"}% -Can't register twice, the username %PARAM1% is already registered. +You cannot register twice, the username '%PARAM1%' is already registered. -Please contact -%WIKIWEBMASTER% -if you have any questions. %TMPL:END% +Did you want to [[TWiki.ResetPassword][reset !%PARAM1%'s password]]? + +Alternatively hit back to go back to TWiki.TWikiRegistration and choose a different username. + +Please contact %WIKIWEBMASTER% +if you have any questions. %TMPL:END% %TMPL:DEF{"topicaction"}% %TMPL:END% %TMPL:P{"oops"}% --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../templates/oopsresetpasswd.tmpl Sat Oct 23 16:58:52 2004 @@ -1,11 +1,14 @@ %TMPL:INCLUDE{"twiki"}% %TMPL:DEF{"titleaction"}%(note) %TMPL:END% %TMPL:DEF{"webaction"}% *Note* %TMPL:END% -%TMPL:DEF{"heading"}%How to reset your TWiki password%TMPL:END% +%TMPL:DEF{"heading"}%Your TWiki password has been changed%TMPL:END% %TMPL:DEF{"message"}% -The following *bold* string is your encrypted password entry: *%PARAM1%* -Please copy this information into a friendly e-mail to -%WIKIWEBMASTER% %TMPL:END% -%TMPL:DEF{"topicaction"}% %TMPL:END% +A new *system-generated* password has been sent to *%PARAM1%*. + +Please proceed to %TWIKIWEB%.ChangePassword to change it to something memorable. + +%TMPL:END% +%TMPL:DEF{"topicaction"}% [[%TWIKIWEB%.ChangePassword][OK]] %TMPL:END% + %TMPL:P{"oops"}% --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../templates/registernotify.tmpl Sat Oct 23 16:59:02 2004 @@ -1,14 +1,10 @@ From: %WIKIWEBMASTER% -To: %EMAILADDRESS% -BCC: %WIKIWEBMASTER% +To: %FIRSTLASTNAME% <%EMAILADDRESS%> Subject: %WIKITOOLNAME% - Registration for %WIKINAME% MIME-Version: 1.0 Content-Type: text/plain; charset=%CHARSET% Content-Transfer-Encoding: 7bit -This is an automated email notification of user registration -in %WIKITOOLNAME%. - Thank you for registering in the %WIKITOOLNAME% collaboration platform. Please save this email for future reference. @@ -22,7 +18,7 @@ You can customize it as you like: * Some people turn it into a personal portal with favorite - links, what they work on etc. + links, what they work on, what help they'd like, etc. * Some add schedule information and vacation notice. * How about attaching your photo? @@ -31,6 +27,11 @@ %FORMDATA% Note: -If you got this email by mistake: Somebody (%FIRSTLASTNAME%) -registered at the %WIKITOOLNAME% site using your mail address -%EMAILADDRESS% . Contact %WIKIWEBMASTER% if needed. + 1 If you got this email by mistake: Somebody (%FIRSTLASTNAME%) + registered at the %WIKITOOLNAME% site using your mail address + %EMAILADDRESS% + Contact %WIKIWEBMASTER% if this is in error. + 2 You can change your password at via + %SCRIPTURL%/view%SCRIPTSUFFIX%/%TWIKIWEB%/ChangePassword + 3 If you haven't set a password yet or you want to reset it, go to: + %SCRIPTURL%/view%SCRIPTSUFFIX%/%TWIKIWEB%/ResetPassword --- /home/mrjc/testwiki.mrjc.com/twiki/pub/TWiki/DistributionContrib/remoteFileSavedLocallyFrom Fri Oct 29 05:22:00 2004 +++ ../templates/view.pattern.tmpl Sat Oct 23 16:59:07 2004 @@ -25,7 +25,7 @@ %TMPL:DEF{"toolbar"}%
- * %EDITTOPIC% + * Edit * Attach * Printable
%WEB%.%TOPIC%%REVINFO%topic end
%TMPL:END%