Welcome to Geeklog, Anonymous Friday, November 29 2024 @ 06:06 am EST
Geeklog Forums
Custom Userform bug?
josheli
Anonymous
Hi. I'm hacking a custom user registration process in 1.8.3-1 and am puzzled by a few code choices. As I see it, the process is like this:
on new register
send to users.php
call custom_userform('new';
which posts to users.php?mode=create
on 2nd pass to users.php
call createuser($username,$email)
inside createuser()...
if(is_email) {
if(email not already used) {
create geek user
create custom user
}
else {
call custom_userform('new';
}
}
else {
call newuserform();
}
shouldn't that last call to newuserform() around line 537 of users.php, inside createuser(), check for a custom_userform?
and again at the bottom of the file, around line 899, inside the switch that's inside the default choice of the main switch, shouldn't there be a check for a custom_userform?
(actually, that whole chunk of code at the bottom of users.php is mysterious to me. what does $msg do at the bottom?
if ($mode != "new" && empty($msg)) {
$msg = $LANG04[31];
}
$display .= COM_siteFooter();
}
break;
}
echo $display;
?>
on new register
send to users.php
call custom_userform('new';
which posts to users.php?mode=create
on 2nd pass to users.php
call createuser($username,$email)
inside createuser()...
if(is_email) {
if(email not already used) {
create geek user
create custom user
}
else {
call custom_userform('new';
}
}
else {
call newuserform();
}
shouldn't that last call to newuserform() around line 537 of users.php, inside createuser(), check for a custom_userform?
and again at the bottom of the file, around line 899, inside the switch that's inside the default choice of the main switch, shouldn't there be a check for a custom_userform?
(actually, that whole chunk of code at the bottom of users.php is mysterious to me. what does $msg do at the bottom?
if ($mode != "new" && empty($msg)) {
$msg = $LANG04[31];
}
$display .= COM_siteFooter();
}
break;
}
echo $display;
?>
10
7
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
I don\'t see an issue. In createuser(), you only want to call the site\'s custom registration form if it exists and is enabled else use newuserform().
The $msg is a message string that will display on the front page above the featured story as in \"Your account has been created\" or \"You have been successfully logged out\". You can look up the $LANG array strings in the language file.
Geeklog components by PortalParts -- www.portalparts.com
Geeklog components by PortalParts -- www.portalparts.com
10
14
Quote
josheli
Anonymous
I don\'t see an issue. In createuser(), you only want to call the site\'s custom registration form if it exists and is enabled else use newuserform().
i know. that\'s my point. at the lines i noted, there is no check to see if the custom form exists or is enabled, so ONLY newuserform() can be called, even if you have implemented a custum_userform().
from my way of thinking, EVERY call to newuserform should be accompanied by a check for a custom_userform().
The $msg is a message string that will display on the front page above the featured story as in \"Your account has been created\" or \"You have been successfully logged out\". You can look up the $LANG array strings in the language file.
yes, again, i know. but after that point in the script, $msg is never called and displayed.
9
14
Quote
The following is the code in users.php for GL 1.3.8
Geeklog components by PortalParts -- www.portalparts.com
if ($_CONF[\'custom_registration\'] AND (function_exists(custom_userform))) {
$retval .= custom_userform (\'new\', \'\', $LANG04[19]);
} else {
$retval .= newuserform ($LANG04[19]);
}
It has the logic to check if the custom function exists and if enabled for the site. Geeklog components by PortalParts -- www.portalparts.com
11
13
Quote
josheli
Anonymous
one of us is missing something. easily could be me. sorry if it is. anyway...
look at createuser() in users.php
what happens if (COM_isEmail($email)) returns false? Here\'s what:
} else {
$retval .= COM_siteHeader (\'Menu\')
. newuserform ($LANG04[18])
. COM_siteFooter();
}
return $retval;
look at the \'default:\' choice in the main switch in users.php. it\'s got another switch embedded in it:
if (!empty($passwd) && $mypasswd == md5($passwd)) {
...code...
} else {
$display .= COM_siteHeader(\'menu\');
$display .= COM_showMessage($msg);
switch ($mode) {
case \'create\':
// Got bad account info from registration process, show error
// message and display form again
$display .= newuserform();
break;
default:
// Show login form
$display .= loginform();
break;
}
thanks for your patience.
9
11
Quote
Status: offline
Blaine
Forum User
Moderator
Registered: 07/16/02
Posts: 1232
Location:Canada
I agree that there may need to be an additional test upon a bad email. I don\'t recall testing that condition nor has the site that\'s been running this for the past 4 months noted it.
Not so sure about the second one - as when that condition would occur. There is a test for $mode = create much earlier so don\'t know when this condition would occur as I look at it now.
Geeklog components by PortalParts -- www.portalparts.com
Geeklog components by PortalParts -- www.portalparts.com
9
10
Quote
Status: offline
josheli
Forum User
Newbie
Registered: 08/16/03
Posts: 7
on the first one, it\'s definitely happening. see this post:
http://www.geeklog.net/forum/viewtopic.php?forum=3&showtopic=23494
on the second one, it will never get called. $mode is checked in the first switch, and if it\'s \'create\', it calls createuser(). so $mode=\'create\' can never make it down to the second switch.
switch($mode)
\'create\':
...
default:
...code...
switch($mode)
\'create\':
......
never happen.
did you see my other post about being able to register without a username?
10
12
Quote
All times are EST. The time is now 06:06 am.
- Normal Topic
- Sticky Topic
- Locked Topic
- New Post
- Sticky Topic W/ New Post
- Locked Topic W/ New Post
- View Anonymous Posts
- Able to post
- Filtered HTML Allowed
- Censored Content