Modify

Opened 9 years ago

Closed 7 years ago

#3401 closed defect (fixed)

[patch] Removing email from preferences makes account unusable

Reported by: Heikki Toivonen (remove -bugzilla when emailing directly) Owned by: John Hampton
Priority: normal Component: AccountManagerPlugin
Severity: normal Keywords: user account corrupt
Cc: Trac Release: 0.11

Description

I had just installed Trac with admin user and AccountManager plugin. I then logged in as admin, and changed the admin prefs to have a name and email address. (This actually limited the account since I had not yet set up outgoing email, but there is a separate bug for that.) I then decided I'd make the email field empty in the hopes that the situation would fix itself. Unfortunately doing that caused every page to show KeyError: 'email' while logged in as that user.

The way I recovered was to use trac-admin to create a new admin account, login with that, delete the old admin account, use trac-admin again to recreate the old admin account, set up working email for admin, and finally delete the second admin account.

Attachments (2)

patch (3.7 KB) - added by anonymous 9 years ago.
empty_email.patch (1.4 KB) - added by Sebastian Krysmanski 8 years ago.
Patch against r5836 and Trac 0.11.4

Download all attachments as: .zip

Change History (11)

comment:1 Changed 9 years ago by anonymous

I've traced down the exception to lines 543-544 of web_ui.py. The issue seems arise from req.session['email'] being None there (see line 544) I've made following changed these lines to following:

            useremail = req.session.get('email')
            if useremail is None:
                useremail = ''
            chrome.add_notice(req, MessageWrapper(tag.span(
                    'An email has been sent to ', useremail,

Not a perfect fix, as this way it still keeps sending an e-mail every time you access a page until you eventually confirm new e-mail. But at least it lets you to confirm the e-mail and works ok after that.

comment:2 Changed 9 years ago by anonymous

I had the same problem. (Trac 0.11.2, TracAccountManager-0.2.1dev). My investigation lead to the attached patch.

Changed 9 years ago by anonymous

Attachment: patch added

comment:3 Changed 9 years ago by anonymous

You may want to take a look at #4125, there is another patch that tries to fix this part of code

comment:4 Changed 9 years ago by John Hampton

Owner: changed from Matt Good to John Hampton
Status: newassigned

Changed 8 years ago by Sebastian Krysmanski

Attachment: empty_email.patch added

Patch against r5836 and Trac 0.11.4

comment:5 Changed 8 years ago by Sebastian Krysmanski

Added a patch against r5836 which also prevents the AccountManagerPlugin from sending an verification email and displaying a warn message if the email adress is empty.

comment:6 Changed 8 years ago by Michael Renzmann

(In [7162]) Add patch from manski which prevents the e-mail address verification mail to be sent if the user has not set an e-mail address. Refs #3401

comment:7 Changed 8 years ago by Michael Renzmann

(In [7164]) Add patch from manski which prevents the e-mail address verification mail to be sent if the user has not set an e-mail address. Refs #3401

comment:8 Changed 8 years ago by Michael Renzmann

With the patch from manski the original issue should be fixed. I've committed the patch to 0.11 and trunk. @pacopablo: I hope you don't mind.

Another thing that should be checked is whether the plugin would try to send e-mails even is no smtp settings are available in trac.ini. I fixed such an issue in another plugin long time ago, but can't remember what plugin it was. Will look into that again.

comment:9 in reply to:  8 Changed 7 years ago by Steffen Hoffmann

Keywords: user account corrupt added
Resolution: fixed
Status: assignedclosed
Summary: Removing email from preferences makes account unusable[patch] Removing email from preferences makes account unusable

Replying to otaku42:

With the patch from manski the original issue should be fixed. I've committed the patch to 0.11 and trunk. @pacopablo: I hope you don't mind.

Good thing, so this ticket is solved. Thank you for the support.

Another thing that should be checked is whether the plugin would try to send e-mails even is no smtp settings are available in trac.ini. I fixed such an issue in another plugin long time ago, but can't remember what plugin it was. Will look into that again.

Certainly this is not as trivial as it sounds. In fact in addition to TracNotification there is AnnouncerPlugin, and both have smtp as well as sendmail transport capability plus enable/disable option to shutdown email even if configured, and maybe even more relevant stuff.

Feel free to open a new ticket, if you see issues related to this, since it's far beyond the scope of the original report here.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain John Hampton.
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.