Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When sending user invite email fails, the email address gets locked and the user cannot be invited #8435

Open
Zharktas opened this issue Sep 13, 2024 · 2 comments · May be fixed by #8461
Open
Assignees

Comments

@Zharktas
Copy link
Member

CKAN version

2.9, probably 2.10, 2.11 and master

Describe the bug

If sending user invite email fails for whatever reason the user gets deleted as is designed.

try:
mailer.send_invite(user, group_dict, data['role'])
except (socket_error, mailer.MailerException) as error:
# Email could not be sent, delete the pending user
_get_action('user_delete')(context, {'id': user.id})
message = _(
'Error sending the invite email, '
'the user was not created: {0}').format(error)
raise ValidationError(message)

When the error causing the failed email sending is fixed, the user cannot be invited as it is in deleted state in the database and email address needs to be unique.

Steps to reproduce

Mis-configure email server.
Invite a user.
Receive an error and the message that user was not created.
Fix the email server configuration.
Try to invite the user again.

Expected behavior

User should be invited.

Additional details

There are some fixes and issues for this already like #5658 and #6916, but those are somewhat counter-intuitive solutions for this. Possible fixes in my mind are either delete the created user completely if invite fails or reactive deleted user when inviting them.

@Zharktas
Copy link
Member Author

In a tech meeting we decided to implement cli commands to resend pending invites and delete user accounts which are in pending state, since they are quite safe to delete as there are no relations in them.

@TomeCirun
Copy link
Contributor

I'm working on it and will provide a PR soon.

@TomeCirun TomeCirun linked a pull request Sep 26, 2024 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants