Modify

Opened 6 years ago

Closed 4 years ago

#3401 closed defect (fixed)

[patch] Removing email from preferences makes account unusable

Reported by: heikki Owned by: pacopablo
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 6 years ago.
empty_email.patch (1.4 KB) - added by manski 5 years ago.
Patch against r5836 and Trac 0.11.4

Download all attachments as: .zip

Change History (11)

comment:1 Changed 6 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 6 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 6 years ago by anonymous

comment:3 Changed 6 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 5 years ago by pacopablo

  • Owner changed from mgood to pacopablo
  • Status changed from new to assigned

Changed 5 years ago by manski

Patch against r5836 and Trac 0.11.4

comment:5 Changed 5 years ago by manski

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 5 years ago by otaku42

(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 5 years ago by otaku42

(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 follow-up: Changed 5 years ago by 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.

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 4 years ago by hasienda

  • Keywords user account corrupt added
  • Resolution set to fixed
  • Status changed from assigned to closed
  • Summary changed from Removing email from preferences makes account unusable to [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.

Add Comment

Modify Ticket

Action
as closed .
as The resolution will be set. Next status will be 'closed'.
to The owner will be changed from pacopablo. Next status will be 'closed'.
The resolution will be deleted. Next status will be 'reopened'.
Author


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

 
Note: See TracTickets for help on using tickets.