[pmwiki-users] Question about Login Names

The Editor editor at fast.st
Tue Mar 21 08:48:45 CST 2006


I have a bit of a perplexing problem.

Right now I am using FAST Membership to get members to create their
own accounts, then have my site to set up instant offices for them,
based on certain conditionals and their username.  The problem is, if
a person selects a login name that begins with a lowercase, when I
create a page called Group.{$AuthId}, it automatically capitalizes the
first letter of their user name.  Then the conditional "if $AuthId =
$Name" no longer works.  And I have not even tested for the
possibility of spaces or special characters that AuthUser might
accept, but would be filtered out in converting to a page name.

Is there some way to automatically modify a login name to
automatically be the same it would be changed to if being used as a
page name?  I.E., call the same function in FAST Membership?  Or
perhaps simpler, check to see if the input name is a valid format?

Here is the function that checks the suggested input name to make sure
it doesn't already exist.  Perhaps it could be modifed here just
before (or after) the if statement:

function GetHtpasswdFormName($pagename) {
  global $_selectedName, $MessagesFmt, $HtpasswordFmt;
  $user = $_REQUEST['logname'];
  if(!$user) {
    $_selectedName = $_REQUEST['idx'];
    $MessagesFmt[] = $HtpasswordFmt['no_user'];
    HandleBrowse($pagename);
    exit;
  }
  return $user;
}

Currently I have a big notice requesting they start their user name
with a capital letter, but no enforcement, and it causes site problems
if they disregard the warning. Plus, there could be other problems
(punctuation, spaces, etc.).  Any suggestions? Something like the
following might be the simplest:

if $user != pmwikifunctionconvertingstringtopagename($user) { error
msg, try again, exit }

Thanks so much!
Caveman




More information about the pmwiki-users mailing list