Modify

Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#180 closed defect (fixed)

changing password creates double entries in password file

Reported by: jjgalvez@… Owned by: Matt Good
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords:
Cc: Trac Release: 0.9

Description

using this plugin to change a password creates double entries in the password file for the user. I looked through your code and I'm not sure why that is. I am currently using trac .9.3 with apache 2.0.55 and python 2.4.2 on windows XP

Attachments (0)

Change History (12)

comment:1 Changed 12 years ago by fox@…

Just wanted to say that I'm running trac 0.9.3, apache, and python 2.4.2 on a linux box (FC4), and it's doing the same thing to me. So, it's not isolated. It always updates both lines w/the new hash, and it doesn't seem to ever create more than two copies of a line. So, it's not that big of a deal, but it is odd.

comment:2 Changed 12 years ago by truijllo@…

Resolution: fixed
Status: newclosed

Hi! the problem in in htfile.py, a wrong indent followed by a wrong conditional statement. this is the patch:

def _update_file(self, prefix, userline):

filename = self._get_filename() written = False if os.path.exists(filename):

for line in fileinput.input(filename, inplace=True):

if line.startswith(prefix):

if not written and userline:

print userline written = True

else:

print line,

if userline and not written:

f = open(filename, 'a') try:

print >>f, userline

finally:

f.close()

return written

comment:3 Changed 12 years ago by truijllo@…

Arg! sorry...

right code for changes is :

....
....
....

if not written and userline:

print userline
written = True


....
....

if userline and not written:

f = open(filename, 'a')



.... ....

comment:4 Changed 12 years ago by Matt Good

Resolution: fixed
Status: closedreopened

Don't close the ticket until your patch has been committed or it will be lost.

comment:5 Changed 12 years ago by trac.ia_mask@…

Has this been confirmed and tested/committed? It's been like 9 days since the post (sorry if I'm expecting too much :-) )

comment:6 Changed 12 years ago by truijllo@…

I don't know, the only thing that I can say is that I use this patch in my trac site ( and it works well :) ). please contact me if I should do a particular way to make my patches accepted.

comment:7 Changed 11 years ago by Max Bowsher

Trac Release: 0.8

Actually, I don't believe the indent is wrong.

I think the proper fix is actually just a one line change:

-        if userline:
+        if not written and userline:

comment:8 Changed 11 years ago by Max Bowsher

I didn't intend to set 'release' to '0.8'.

It seems someone has reconfigured this Trac so that it gets set on any ticket which does not have a 'release' value set, when someone next makes a comment.

comment:9 Changed 11 years ago by jml

Trac Release: 0.80.9

OK. I've confirmed this bug and came up with the same fix as maxb.

Apparently there is a patch on #264, but it's tied up with another issue. I figure attaching a patch here will be quicker.

comment:10 Changed 11 years ago by jml

OK. Trac barfed when I tried to upload the patch. Anyway, it's exactly what maxb had.

comment:11 Changed 11 years ago by Matt Good

Resolution: fixed
Status: reopenedclosed

(In [1046]) stop writing duplicate entries in password file when updating password (fixes #180)

comment:12 Changed 11 years ago by Matt Good

Thanks for debugging this. Sorry for the long delay in getting these changes committed. I've added some docs on that method now too, since I couldn't quite remember exactly what its behavior was supposed to be ;)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Matt Good.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.