#!/usr/bin/perl -T # edit-member.pl - edit user's member information. # Copyright Board of Trustees of the University of Illinois at UC, April 1995 # This is used via a URL like: # http://www.hypernews.org/HyperNews/edit-member.pl?user # Add current directory to load path. $0 = $ENV{SCRIPT_FILENAME} if $0 =~ m{^/dev}; $0 =~ m{^(.*)/[^/]+$ }x; $hnbin = $1 || '.'; unshift(@INC, $hnbin, "$hnbin/.scripts"); require "Admin/hnrc"; &feval('&EditMember()'); sub EditMember { local $debug = 0; require "urc.pl"; require "member-lib.pl"; require "edit-lib.pl"; require 'formlib.pl'; my %form = &GetFormArgs(); # Check for server or cookie authentication, or maybe login. &checkAuthenticated($form{UserID}, $form{Password}, $form{remoteUser}, $form{adminPassword}); my $isAdmin = $authenticated && &isAdmin($remoteUser); # &HNMsg("hndocs: $hndocs"); # &HNMsg("SCRIPT_NAME: $ENV{SCRIPT_NAME}"); # &HNMsg("hnprefix: $hnprefix"); # &HNMsg("hnbinURL: $hnbinURL"); my $whoami = &sustring($remoteUser); if ($whoami) { $whoami = "You are: $whoami
"; } my $whoisthat; my $adminEmail = &addressOf(@hnAdmin[0]) || @hnAdmin[0]; $qs = $ENV{QUERY_STRING}; &HNMsg("Query string: '$qs'") if $debug; my %args = &parseQueryString(); $userid = $args{userid} || $qs || $remoteUser; # allow ?user &HNMsg("userid is '$userid', Remote User is '$remoteUser'") if $debug; my %member = &getMember($userid); &printAssoc("Member '$userid'", %member) if $debug; my $registering = $args{new}; my $thisURL = $ENV{REQUEST_URI}; $thisURL ||= ($qs ? "$editMemberURL?$qs" : $editMemberURL); $thisURL = &URLencode($thisURL); my $redirectURL = "$loginURL?userid=$userid&url=$thisURL"; # We are not changing anything yet, but still must do access control. # (But this does not check the right thing yet.) # &access1($joinSF, 2, $userid, $remoteUser, # "You, '$remoteUser', can not update membership info for # user '$userid'", # $authenticated); # Special access check for inquiries. if (($authenticateInquiries || $hideUserIDs) && %member) { if ($userid && !$authenticated) { # && $manualSecurity # Try logging in first. This may not be workable. # Maybe should require manualSecurity. &printRedirect($redirectURL); } elsif ($userid && ($userid ne $remoteUser) && !$isAdmin) { &HNUserError( qq{ You, $remoteUser, are not permitted to inquire about other members - all member data is private. If you want to edit your own member data, go to here. }); } } # my $URL = $ENV{'PATH_INFO'}; if ($userid) { # &HNMsg("Getting New Member info for $userid"); # &printAssoc('member', %member); $newUserID = $member{'UserID'}; #&HNMsg("userid: $userid newUserID: $newUserID"); $emailAddress = $member{'Email'}; $userName = $member{'Name'}; $userURL = $member{'UserURL'}; $userPhone = $member{'Phone'} || $member{'UserPhone'}; $userAddress = $member{'MailAddress'} || $member{'UserAddress'}; $content = $member{'Content'}; $format = $member{'Format'}; my $memberOrAdmin = "a member"; if (&isAdmin($userid)) { # In what group? $memberOrAdmin = "an administrator"; } if ($hnGroup) { $groupScope = " in group $hnGroup"; } my $groupName = $hnGroup; $groupName =~ s,^/,,; if ($newUserID) { if ($newUserID ne $remoteUser) { if ($newUserID ne $userid) { $whoisthat = "\"$userid\" has $UserIDorHandle \"$newUserID\"."; $userid = $newUserID; } if ($hnGroup) { if (-e "$hnPeople$hnGroup/$userid") { $whoisthat .= " $userid is $memberOrAdmin of \"$groupName\"."; } else { $whoisthat .= " $userid is not a member of \"$groupName\"."; } } else { $whoisthat ||= " \"$userid\" is $memberOrAdmin."; } } } else { $whoisthat .= " \"$userid\" is not a member."; } $whoisthat = " \n $whoisthat

\n" if $whoisthat; } if (!$authenticated) { # $joinSF == 1 && !$authenticateInquiries # if ($joinSF == 2) { $orMember = "or Current Member"; } if (!$registering) { $passwordOption = qq{


Current Password for $hnSystemName:
}; if (!$authenticateInquiries) { $passwordOption .= " (required to Update anything if you are already a member)"; } } $adminline = qq{


(Ignore this unless you are an Administrator $orMember making updates for the User)

Administrator $orMember:

Admin $orMember Password:
}; if ($resetPasswordSF && !$externalSecurity) { $resetOption = qq{

(If you have a password but cannot remember it, you can }; if ($resetPasswordSF == 2) { $resetOption .= 'ask another member to '; } elsif ($resetPasswordSF == 3) { $resetOption .= qq{ ask an administrator ($adminEmail) to }; } my $yourUserID = ", '$userid', " if $userid; my $thisURL = $editMemberURL; $thisURL .= "?userid=$userid" if $userid; $resetOption .= qq{ reset it to a random password. Be sure to mention your $UserIDorHandle$yourUserID and this URL: $thisURL.)

}; } # $resetPasswordSF } # !$authenticated else { # Pass these through to reauthenticate. $adminline = qq{ }; } #============================================ &print_HTML_HEAD("$hnSystemName Membership Form"); my $siteIntro; if (-e "$hndocs/.intro.html") { open PH, "$hndocs/.intro.html"; my @lines = ; close PH; $siteIntro = join ('', @lines); } my $sitePolicy; if (-e "$hndocs/.policy.html") { open PH, "$hndocs/.policy.html"; my @lines = ; close PH; $sitePolicy = join ('', @lines); } if ($showPriv) { # This should really be on a different page, # but it is sometimes useful info. $privMsg = "Read about the access restrictions that apply here at the bottom of this page."; $priv = qq{


Access Restrictions at $hnSystemName

}; } if ($ENV{REMOTE_USER}) { # Server authenticated. $updateMemberURL = $SECUREDupdateMemberURL; } if (!$authenticateInquiries && !$hideUserIDs && !$registering && !$viewMembers) { # This stuff is probably not useful here anymore - see view-member.pl $inquireMsg = 'Or you can inquire about an existing member.'; $inquireMsg2 = qq{
  • To inquire about an existing member (perhaps yourself), enter the member\'s $UserIDorHandle below and then go to the bottom of the form and select Do It. Everything else on the form will be ignored.

    }; } if (!$authenticated && $joinSF && $joinSF < 3) { my $shouldOrMust = ($requirePasswords ? 'must' : 'should'); my $passwordMsg; $passwordMsg = qq{You $shouldOrMust provide a new password since it protects you from unauthorized use of your $UserIDorHandle.} if !$generatePasswords; my $nameMsg = qq{ You should provide a Name since it is used to identify you in messages. } if $getPersonalData; if ($manualSecurity && ($UseCookies eq 'always')) { $loginMsg = qq{

  • If you are already a member, please login first.

    }; } $registerMsg = qq{

  • To register as a new member, first make up a $UserIDorHandle and enter it immediately below. Make it something that you can remember and easily type - it may be a "nickname"$emailid. Then fill in the rest of the form. $nameMsg $passwordMsg }; # some stuff used below $registerOrUpdate = "Register"; $registerOrUpdate .= " or Update" if !$registering; $registerOrUpdate2 = "either register as a new member, or"; } else { $registerOrUpdate = "Update Information"; } if ($inquireMsg) { $submitControls = qq{ Inquire about $UserIDorHandle Register Update

    }; $registerMsg .= qq{ Finally, select Register and click on 'Do It'.

    }; } else { if (!$authenticated) { $submitControls = qq{ }; $registerMsg .= qq{ Finally, click on the $registerOrUpdate button.

    }; } else { $submitControls = qq{ }; $registerMsg .= qq{ Finally, click on the Update button.

    }; } } if ($member{Status} eq 'invited') { $welcomeMsg = qq{ Thank you for acting on our invitation to join us. Please fill out and submit this membership registration form to officially accept the invitation. You can then participate in the forums.


    }; } if ($hnReadSF == 1) { $secureMsg = qq{ As a member, only you can use your $UserIDorHandle or Email Address; the system will request your password to prove it is you. }; } if ($showPriv) { my $top_URL_msg = qq{, and it is located at $topURL} if 0; #Each HyperNews site has its own set of members, # so being a member here does not mean you are a member at other sites. $introMsg = qq{ With this form, you can $registerOrUpdate2 update your current membership information. $inquireMsg $secureMsg Membership applies to all forums at this site.

    Note that this site uses the HyperNews system (version $hnversion). This site is called "$hnSystemName"$top_URL_msg. The administrator is $adminEmail. $privMsg

    }; } my $changeURL = ($authenticated ? $SECUREDchangeMemberURL : $changeMemberURL); print qq{

    $hnSystemName Membership

    $siteIntro $welcomeMsg $introMsg
    }; my $subscribeOption; if ($hnEmail) { my $hideEmailOption; if (!$hideEmailAddresses) { my $orMemberLists = qq{ or member lists} if $viewMembers; $hideEmailChecked = 'CHECKED' if ($member{Hide} eq 'Email'); $hideEmailOption = qq{ Hide my Email Address:
    Do not show my Email address in messages$orMemberLists.

    }; } my $andSubscription; my $alsoNotifications; if ($hnEmailNotify) { $andSubscription = qq{and Subscription}; $alsoNotifications = qq{ $hnSystemName will also send you new postings via email if you "subscribe" to forums.}; my %subOpt = (); $subOpt{$member{Subscribe} || ($defaultSubscribeAll ? 'all' : 'some')} = 'CHECKED'; my $subscribeAllOpt; if ($allMemberForums ne 'none') { $subscribeAllOpt = qq{ Also all forums that subscribe All-Members
    }; } elsif ($subOpt{all}) { # Switch to another default value since 'all' is not an option. $subOpt{some} = 'CHECKED'; } $subscribeOption = qq{ Subscribe to:
    Only what I specify in each forum.
    $subscribeAllOpt Nothing - Please UNSUBSCRIBE me from all forums at $hnSystemName).

    }; $contentOption = 'Content:
    "; $formatOption = 'Format:
    "; # Options to specify what to mail to you (ignored for now): #
    #$contentOption #$formatOption } my $emailPassword = qq{ When you submit this registration form, your password will be emailed to you.} if ($generatePasswords && !$authenticated); $emailOptions = qq{


    Email $andSubscription Options

    $emailPassword $hnSystemName will send you email each time you update your membership information. $alsoNotifications A full internet Email address is required for this purpose.

    Email Address: (example: jdoe\@my.home.net, case sensitive)

    $hideEmailOption $subscribeOption }; } $emailid = " or email address" if $allowEmailUserID; if ($generatePasswords) { # && $hnEmail $newPasswordOption .= "


    New members will receive a random password in an email message.

    "; } # Maybe: # Only show "register" stuff if not authenticated. # Only show "update" stuff if authenticated. if (!$authenticated) { $userIDpasswordNeeded = qq{ But you will need to enter your $UserIDorHandle and current password at the end. You should inquire about your membership first, however. }; # Or use SECUREDeditMemberURL?userid=$userid } $updateMsg = qq{

  • To update your membership information, you only need to enter the fields that you are changing, and make sure the check boxes are set properly. $userIDpasswordNeeded

    } if !$registering; my $registerOrUpdateMsg; if (!$authenticated) { $registerOrUpdateMsg .= $registerMsg; } # if ($authenticated || $isAdmin) { # always show this $registerOrUpdateMsg .= $updateMsg; # } # Allow user to update password unless # generatePasswords and new user, or external security. # But we can't test for new user if manual security. if (!$externalSecurity && (!$generatePasswords || $authenticated)) { my $specify_or_update = "specify or update"; $specify_or_update = "specify" if $registering; $specify_or_update = "update" if $authenticated; $newPasswordOption = qq{


    To $specify_or_update your password, enter a new password here twice.
    DO NOT USE YOUR INTERNET LOGIN PASSWORD.

    New Password:

    New Password again:

    }; } if (($UseCookies eq 'sometimes')) { # was: && $HNCookiePassword # How long should a cookie be validated for. # Not fully implemented yet. $member{SessionLength} ||= 'none'; my %selected; $selected{$member{SessionLength}} = 'CHECKED'; my $default_session_length; if ($CookieLifespan == 0) { $default_session_length = qq{Until I quit my browser.}; } else { $default_session_length = qq{For $CookieLifespan days.}; } $sessionOption = qq{ Remember me:
    ($hnSystemName can use "cookies" to let your browser remember your login using your $UserIDorHandle and Password for some period of time. You must also enable cookies in your browser.)
    Not at all.
    $default_session_length
    }; } if ($getPersonalData) { # Get more member fields. my %memberFields = &parseURCFile("$hnPeople/.member-fields"); my $moreFields = ''; foreach $name (keys %memberFields) { my ($maxlength, $xsize, $ysize, $description) = split ('\|', $memberFields{$name}); if ($ysize < 2) { $moreFields .= qq{ $name ($description):

    }; } else { $moreFields .= qq{ $name ($description):

    }; } } $personalURLOption = qq{ Personal Home Page URL (example: http://my.home.net/):

    }; $personalOptions = qq{


    Personal Data

    Please tell us about yourself. Your Name is used to identify you in your messages; otherwise your Email address or $UserIDorHandle is used. You can leave any of these fields blank, if you would prefer.

    Name (example: John Doe):

    $moreFields $personalURLOption }; } print qq{


      $loginMsg $registerOrUpdateMsg $inquireMsg2
    $whoami $whoisthat $UserIDorHandle (nickname$emailid, no spaces, case sensitive):

    $emailOptions $personalOptions $newPasswordOption $sessionOption $passwordOption $resetOption


    Finally...

    $submitControls

    $adminline

  • $priv $sitePolicy }; print qq{

    [ Help for $hnSystemName ]

    } if $instructionsURL; &printEnd(); }