Is it possible to skip the login after signup? It'd be great if the person would just be logged in after entering the signup info. Help is always appreciated.
Jun 29, 2000, 6:01 PM
Veteran / Moderator (8669 posts)
Jun 29, 2000, 6:01 PM
Post #2 of 11
Views: 2519
You can add the following to sub signup, after the new password is written to the file:
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
JPD
http://www.jpdeni.com/dbman/
Code:
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
http://www.jpdeni.com/dbman/
Jun 30, 2000, 7:26 AM
Novice (19 posts)
Jun 30, 2000, 7:26 AM
Post #3 of 11
Views: 2495
JPDeni, I tried inserting it and didn't get anything different when I signed up a new account. I just inserted it at the end of sub_signup. Should it go within the '{}'s of the password recording part. Here's what I did:
sub signup {
# --------------------------------------------------------
# Allows a user to sign up without admin approval. Must have $auth_signup = 1
# set. The user gets @default_permissions.
#
my $message;
# Check to make sure userid is ok, pw ok, and userid is unique.
unless ((length($in{'userid'}) >= 5) and (length($in{'userid'}) <= 30) and ($in{'userid'} =~ /^[a-zA-Z0-9\.]+$/)) {
$message = "Invalid userid: $in{'userid'}. Must only contain only letters and be less then 30 and greater then 5 characters.";
}
unless ((length($in{'pw'}) >= 3) and (length($in{'pw'}) <= 12)) {
$message = "Invalid pw: '$in{'pw'}'. Must be less then 12 and greater then 3 characters.";
}
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
while (<PASS>) {
/^\Q$in{'userid'}\E:/ and ($message = "userid already exists. Please try another.");
}
unless ($in{'question1'} =~ /griffiths/i) {
$message = "$in{'question1'} is not a correct answer.";
}
unless ($in{'question2'} =~ /west end/i) {
$message = "$in{'question2'} is not a correct answer.";
}
unless ($in{'question3'} =~ /pavilion/i) {
$message = "$in{'question3'} is not a correct answer.";
}
close PASS;
if ($message) {
&html_signup_form ($message);
return;
}
# Add the userid into the file with default permissions.
open (PASS, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($in{'pw'}, $salt);
my $permissions = join (":", @auth_signup_permissions);
print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;
&html_signup_success;
}
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
sub get_record {
# --------------------------------------------------------
# Given an ID a
Thanks a million.
sub signup {
# --------------------------------------------------------
# Allows a user to sign up without admin approval. Must have $auth_signup = 1
# set. The user gets @default_permissions.
#
my $message;
# Check to make sure userid is ok, pw ok, and userid is unique.
unless ((length($in{'userid'}) >= 5) and (length($in{'userid'}) <= 30) and ($in{'userid'} =~ /^[a-zA-Z0-9\.]+$/)) {
$message = "Invalid userid: $in{'userid'}. Must only contain only letters and be less then 30 and greater then 5 characters.";
}
unless ((length($in{'pw'}) >= 3) and (length($in{'pw'}) <= 12)) {
$message = "Invalid pw: '$in{'pw'}'. Must be less then 12 and greater then 3 characters.";
}
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1); }
while (<PASS>) {
/^\Q$in{'userid'}\E:/ and ($message = "userid already exists. Please try another.");
}
unless ($in{'question1'} =~ /griffiths/i) {
$message = "$in{'question1'} is not a correct answer.";
}
unless ($in{'question2'} =~ /west end/i) {
$message = "$in{'question2'} is not a correct answer.";
}
unless ($in{'question3'} =~ /pavilion/i) {
$message = "$in{'question3'} is not a correct answer.";
}
close PASS;
if ($message) {
&html_signup_form ($message);
return;
}
# Add the userid into the file with default permissions.
open (PASS, ">>$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) {
flock(PASS, 2) or &cgierr("unable to get exclusive lock on $auth_pw_file.\nReason: $!");
}
srand( time() ^ ($$ + ($$ << 15)) ); # Seed Random Number
my @salt_chars = ('A' .. 'Z', 0 .. 9, 'a' .. 'z', '.', '/');
my $salt = join '', @salt_chars[rand 64, rand 64];
my $encrypted = crypt($in{'pw'}, $salt);
my $permissions = join (":", @auth_signup_permissions);
print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;
&html_signup_success;
}
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
sub get_record {
# --------------------------------------------------------
# Given an ID a
Thanks a million.
Jun 30, 2000, 3:21 PM
Veteran / Moderator (8669 posts)
Jun 30, 2000, 3:21 PM
Post #4 of 11
Views: 2490
No. The code needs to go after the username is written to the .pass file:
print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
&html_signup_success;
}
JPD
http://www.jpdeni.com/dbman/
Code:
print PASS "$in{'userid'}:$encrypted:$permissions\n";
close PASS;
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;
}
&html_signup_success;
}
http://www.jpdeni.com/dbman/
Jul 5, 2000, 10:43 PM
Enthusiast (944 posts)
Jul 5, 2000, 10:43 PM
Post #5 of 11
Views: 2470
Could this be done with the Secure Password Lookup mod? I would assume so, but I'm not having much luck thus far. I imagine
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin)
would have to be changed to match the format of the secured default.pass file, but I'm not finding anything that works. At least I'm not getting any errors.
Ideal would be bypassing the login after signup, in conjunction with the cookie mod, so that they never have to enter their password (assuming the cookies do their thing -- often not the case in Netscape). As it is, I have a database with the cookie mod plugged into a few different pages, so someone signing up for an account has the option of setting the cookie on their initial login. There are a lot of lazy people out there though, and one login is one too many for a lot of them...
Dan
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin)
would have to be changed to match the format of the secured default.pass file, but I'm not finding anything that works. At least I'm not getting any errors.

Ideal would be bypassing the login after signup, in conjunction with the cookie mod, so that they never have to enter their password (assuming the cookies do their thing -- often not the case in Netscape). As it is, I have a database with the cookie mod plugged into a few different pages, so someone signing up for an account has the option of setting the cookie on their initial login. There are a lot of lazy people out there though, and one login is one too many for a lot of them...
Dan
Jul 6, 2000, 1:47 AM
Veteran / Moderator (8669 posts)
Jul 6, 2000, 1:47 AM
Post #6 of 11
Views: 2472
I don't know anything about cookies, except for the kind you eat.
But I have a feeling that it might be difficult to set the cookie through the script without logging in at least once. Or at least, the coding would have to be done by someone who knows about such things.
Yes, you would be able to have them log in after the sign up -- if you aren't using the completely secure lookup mod. It would sorta defeat the purpose of verifying the email address if they didn't have to enter the password they got by email.
JPD
http://www.jpdeni.com/dbman/

Yes, you would be able to have them log in after the sign up -- if you aren't using the completely secure lookup mod. It would sorta defeat the purpose of verifying the email address if they didn't have to enter the password they got by email.
JPD
http://www.jpdeni.com/dbman/
Jul 25, 2000, 4:41 PM
Novice (19 posts)
Jul 25, 2000, 4:41 PM
Post #8 of 11
Views: 2403
JPDeni, I don't know what I've done. I cut your response out to get:
close PASS;
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9\.]+)\.\d+/;
}
&html_signup_success;
When I run the script I get nothing. It just directs me to the login page as before without a screwed up address or anything. Are there variables above that I have to define? Would having html autogenerate off affect it. I'm clueless. Thanks.
close PASS;
# This should send the new signup straight into the script instead of making them login again.
$in{'login'} = 1;
$db_uid = "";
($status, $uid, $per_view, $per_add, $per_del, $per_mod, $per_admin) = &auth_check_password;
if ($status eq "ok") {
$db_script_link_url = "$db_script_url?db=$db_setup&uid=$db_uid";
($db_userid) = $db_uid =~ /([A-Za-z0-9\.]+)\.\d+/;
}
&html_signup_success;
When I run the script I get nothing. It just directs me to the login page as before without a screwed up address or anything. Are there variables above that I have to define? Would having html autogenerate off affect it. I'm clueless. Thanks.
Jul 25, 2000, 5:08 PM
Veteran / Moderator (8669 posts)
Jul 25, 2000, 5:08 PM
Post #9 of 11
Views: 2464
Jul 25, 2000, 9:09 PM
Veteran / Moderator (8669 posts)
Jul 25, 2000, 9:09 PM
Post #11 of 11
Views: 2408
I don't know what I was thinking before. I guess I was focusing on the other code and forgot what the end result was supposed to be.
JPD
http://www.jpdeni.com/dbman/

JPD
http://www.jpdeni.com/dbman/