Description
MoinMoin sends two events for new accounts when you hit the "create + send email" button.
Steps to reproduce
- log in as superuser
- subscribe to new account notifications
- log out
- create new user and hit "create + send email" button
- see two notifications
Component selection
- user handling
Details
Here are two stacktraces I captured:
File "/usr/local/src/moin/MoinMoin/action/newaccount.py", line 180, in execute request.theme.add_msg(_create_user(request), "dialog") File "/usr/local/src/moin/MoinMoin/action/newaccount.py", line 84, in _create_user theuser.save() File "/usr/local/src/moin/MoinMoin/user.py", line 594, in save events.send_event(event) File "/usr/local/src/moin/MoinMoin/events/__init__.py", line 242, in send_event retval = handle(event) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 173, in handle return handle_user_created(event) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 125, in handle_user_created send_notification(request, from_address, [usr.email], data, trace=True) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 68, in send_notification txt += '\n' + ''.join(traceback.format_stack())
File "/usr/local/src/moin/MoinMoin/action/newaccount.py", line 180, in execute request.theme.add_msg(_create_user(request), "dialog") File "/usr/local/src/moin/MoinMoin/action/newaccount.py", line 87, in _create_user theuser.mailAccountData() File "/usr/local/src/moin/MoinMoin/user.py", line 1019, in mailAccountData tok = self.generate_recovery_token() File "/usr/local/src/moin/MoinMoin/user.py", line 987, in generate_recovery_token self.save() File "/usr/local/src/moin/MoinMoin/user.py", line 594, in save events.send_event(event) File "/usr/local/src/moin/MoinMoin/events/__init__.py", line 242, in send_event retval = handle(event) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 173, in handle return handle_user_created(event) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 125, in handle_user_created send_notification(request, from_address, [usr.email], data, trace=True) File "/usr/local/src/moin/MoinMoin/events/emailnotify.py", line 68, in send_notification txt += '\n' + ''.join(traceback.format_stack())
MoinMoin Version |
1.7 and 1.8 |
Workaround
N/A
Discussion
The problem appears to be that User.save() has the following check:
but the code in the newaccount action ends up saving the same user object twice, when obviously it doesn't have _loaded set to True. This should probably be called "_in_storage" instead of "_loaded" and set to True in .save() as well.
Another issue is that the "create + email" button is entirely useless because you only get password recovery instructions. And you've just set your password...
I would/had expected to getting a nice welcome e-mail like dear surename lastname blabla... your account is blabla and link to help blabla.. -- MarcelHäfner 2008-07-14 11:05:21
Well, that would be nice, but it's something entirely different, it's just sending password reset now. -- JohannesBerg 2008-07-14 11:20:26
Plan
- Priority:
Assigned to: JohannesBerg
Status: fixed in http://hg.moinmo.in/moin/1.7/rev/f40bd4c68aa2 and merged to 1.8, removed create+email button.