Gossamer Forum
Home : Products : DBMan : Customization :

Signup - > Login

Quote Reply
Signup - > Login
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.

Quote Reply
Re: Signup - > Login In reply to
You can add the following to sub signup, after the new password is written to the file:

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+/;
}
JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Signup - > Login In reply to
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.




Quote Reply
Re: Signup - > Login In reply to
No. The code needs to go after the username is written to the .pass file:

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;
}
JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Signup - > Login In reply to
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. Wink

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

Quote Reply
Re: Signup - > Login In reply to
I don't know anything about cookies, except for the kind you eat. Smile 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/
Quote Reply
Re: Signup - > Login In reply to
In Reply To:
It would sorta defeat the purpose of verifying the email address if they didn't have to enter the password they got by email.
Good point. Maybe the way I have it now is best -- having them log in initially and setting the password that time. Maybe I should focus my energies on convincing the users that's not so tough!

Dan

Quote Reply
Re: Signup - > Login In reply to
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.

Quote Reply
Re: Signup - > Login In reply to
Try changing

&html_signup_success;

to

&html_home;



JPD
http://www.jpdeni.com/dbman/
Quote Reply
Re: Signup - > Login In reply to
You're a genius, worked like a charm.

Thanks

Quote Reply
Re: Signup - > Login In reply to
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. Smile

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