Gossamer Forum
Home : Products : Links 2.0 : Customization :

NEW MOD: Modify.cgi password protection/autofiller

(Page 2 of 2)
> >
Quote Reply
Re: [Paul] NEW MOD: Modify.cgi password protection/autofiller In reply to
Hi Paul. Just wondeirng if you've come up with a work-around on this one? I've been trying..it seems simple.. basically you'd just need to retreive the original password from the db file before you overwrite it, and compare it to the one that was passed from the modify; if they're the same you leave it, if they're not you reverse it...unfortunetly I'm not that great at Perl...so I'm not getting too far...
Quote Reply
Re: [Paul] NEW MOD: Modify.cgi password protection/autofiller In reply to
Hi,

great mod Paul. The only thing I miss is to

use one username/password for more than one link.



Greetings

Christian
Quote Reply
Re: [ti.german] NEW MOD: Modify.cgi password protection/autofiller In reply to
Hi Paul; was just wondering if any solution for this has been worked out?

Thanks!
Post deleted by dj1s In reply to
Quote Reply
Re: [Paul] NEW MOD: Modify.cgi password protection/autofiller In reply to
Does any one know if this mod is still available....all links on theis post are dead??
Quote Reply
Re: [Hamsterpants] NEW MOD: Modify.cgi password protection/autofiller In reply to
Hope Paul is still around!!

Attached is the zip for the mod...


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] NEW MOD: Modify.cgi password protection/autofiller In reply to
Hi Leonard,

Thanks for posting the mod. I have installed and all seems to be ok...Only problem is that when I enter the username and password, I get Invalid username or password. Record not found. Can't understand it, username and password exist in the database, and I entered them exactly the same way as they we saved...Any ideas where I can start looking to find where the problem may be?

The only thing that I think may be a problem is that I had allready added the username and password fields prior to installing the mod, would that make a differance?

Hamsterpants
Quote Reply
Re: [Hamsterpants] NEW MOD: Modify.cgi password protection/autofiller In reply to
Never mind, found what I did wrog...I didn't set the input type in add.html to password...changed that and all is working now

Thanks again

Hamsterpants
Quote Reply
Re: [Paul] NEW MOD: Modify.cgi password protection/autofiller In reply to
I have just installed this mod. I had a few small issues. Both have been mentioned here in this thread, but no fix has been posted.


-----
ecm: "First, after making changes and clicking the modify resource, I got an error msg "Category (Can not be left blank)". Then I would get an error message "A request to modify this record has already been received. Please try again later.""
-----

I am currently having this issue, I realize its a matter of changing the script to create a drop down instead of just passing the value, gonna go look at this to see if I can figure it out in a moment.

-----
DanJ: "Once a user goes into the actual modify section, if they change their password it isn't reversed in the database and therefore if they use that password its denied"
-----

I had this issue and I fixed it by simply removing the reversing feature of the script. A submitted username/password is much stronger them what we had before and I just didnt see the need for the reverse password as I know it would have confused some of my users anyways.


Peace,

MadTech (Rick)
Quote Reply
Re: [madtech] NEW MOD: Modify.cgi password protection/autofiller In reply to
To fix the category issue, open site_html_templates.pl

make sure your site_html_modify_form sub looks similar to this...

Code:


sub site_html_modify_form {
# --------------------------------------------------------
# This routine determines how the modify form page will look like.

my (%record) = @_;
my $cat ?
($record{'Category'} = qq~<input type=hidden name="Category" value="$record{'Category'}">$record{'Category'}~) :
($record{'Category'} = &build_select_field ("Category"));

&html_print_headers;
print &load_template ('modify.html', {
Cat => $cat,
%record,
%globals
});
}


Hope that helps the few of us who still use Links 2.0

Only other issue I just noticed with this mod is that if you request a lost password and you have more then one resource with that e-mail address, it only sends you the user/pass for the first one it encounters.

Peace,

MadTech
Quote Reply
Re: [madtech] NEW MOD: Modify.cgi password protection/autofiller In reply to
I was just looking back through to see if anyone found a way to make the password retrieval work correctly? As I stated last year in this thread, when you load the password retrieval page and put in your e-mail address it only gives you the first listing if finds with that e-mail. If you have 3 listings with one email it doesnt allow you to retrieve all listings.
Quote Reply
Re: [madtech] NEW MOD: Modify.cgi password protection/autofiller In reply to
I have not solved your problem, but maybe somebody can look at this code and see what it needs. I'm sure it's pretty simple, just gotta know perl...

This is from modify_ret.cgi:

sub process_form {
# --------------------------------------------------------

($in{'Email'} !~ /.+@.+\..+/[/url]) and &site_html_modify_up_ret_failure ("You did not specify a valid email address.") and return;

# Let's check to make sure the link we want to update is actually
# in the database.
open (DB, "<$db_file_name") or &cgierr("Error in validate_records. unable to open db file: $db_file_name. Reason: $!");
$found = 0;
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
if ($data[$db_contact_email] eq $in{'Email'}) {
$u = $data[$db_user];
$p = reverse $data[$db_pw];
$t = $data[$db_title];
$n = $data[$db_contact_name];
$found = 1;
last LINE;
}
}
close DB;
!$found and &site_html_modify_up_ret_failure ("Record not found.") and return;
if ($found) {
&send_email();
&site_html_modify_up_ret_success() and return;
}
}


Leonard
aka PerlFlunkie
Quote Reply
Re: [PerlFlunkie] NEW MOD: Modify.cgi password protection/autofiller In reply to
you are right... the solution i came up with (even though its two years later Crazy) is to have the email include multiple passwords and usernames for each title they have on file under the email. Replace both process_form and send_email in modify_ret.cgi with the following:

Code:

sub process_form {
# --------------------------------------------------------

($in{'Email'} !~ /.+@.+\..+/[/url]) and &site_html_modify_up_ret_failure ("You did not specify a valid email address.") and return;

# Let's check to make sure the link we want to update is actually
# in the database.
open (DB, "<$db_file_name") or &cgierr("Error in validate_records. unable to open db file: $db_file_name. Reason: $!");
$found = 0;
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
if ($data[$db_contact_email] eq $in{'Email'}) {
if ($found > 0) {

$u[$found] = $data[$db_user];
$p[$found] = $data[$db_pw];
$t[$found] = $data[$db_title];
$n[$found] = $data[$db_contact_name];
$found++;
}
else {

$u = $data[$db_user];
$p = $data[$db_pw];
$t = $data[$db_title];
$n = $data[$db_contact_name];
$found = 1;
# last LINE;
}
}
}
close DB;
!$found and &site_html_modify_up_ret_failure ("Record not found.") and return;
if ($found) {
&send_email();
&site_html_modify_up_ret_success() and return;
}
}
sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated.
if ($n =~ /^(\w+)\s\w+$/) {
$n = $1;
}
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $in{'Email'};
my $from = $db_admin_email;
my $subject = "Password retrieval for: $t";
my $msg = qq|Hello $n,|;
$found = $found - 1;
if ($found > 0) {
$msg .= qq|
Here are your Contact Names and Passwords for all your listings:

Company Name : $t
Username : $u
Password : $p
|;
$number = 1;
while ($found >= $number) {
$msg .= qq|
Company Name : $t[$number]
Username : $u[$number]
Password : $p[$number]
|;
$number++;
}
} else {
$msg .= qq|
Here is your Contact Name and Password:
Username : $u
Password : $p|;
}
$msg .= qq|
found is $found
Please login here:
$db_cgi_url/modify.cgi

Sincerely,
Links Manager.
|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return undef;
$mailer->send or return undef;
}



Hope that helps :D




Vote Stinky

Last edited by:

security_man: Nov 26, 2006, 2:37 AM
Quote Reply
Re: [security_man] NEW MOD: Modify.cgi password protection/autofiller In reply to
The code above gave me nothing but errors, so from what I have experienced, the last issue is not solved yet. I hope someone can fix this once and for all.Smile
Quote Reply
Re: [LILHOMIE] NEW MOD: Modify.cgi password protection/autofiller In reply to
Please make sure the mod you installed was for your version of Links. Not all version 2 Links are the same and all mods are not necessarily functional with both versions.
Quote Reply
Re: [Bobsie] NEW MOD: Modify.cgi password protection/autofiller In reply to
Thanks for the reply, I found a modify protect that worked for me. I am crosseyed for looking at all these posts.
> >