Error when trying to save duplicate email

This error was logged on a fully up to date discourse:

Discourse::InvalidParameters (email) /var/www/discourse/app/controllers/users_controller.rb:487:in `change_email’

Repro:

  • Allow emails to be changed
  • visit a user’s profile
  • enter in a duplicate email
  • Get a normal warning

this will be logged:
https://gist.github.com/YesThatAllen/0dfc52427d3042245d6f

3 Likes

Hmm can you repro this @techapj?

2 Likes

Yes, I was able to repro this. I made two fixes:

  • change button will be disabled when the email is duplicate (i.e. same as user’s current email).

  • In case the new email user provided is already in use by another user than instead of serving 500 (Internal Server Error), 422 error will be served with proper error message.


https://github.com/discourse/discourse/commit/00649270770674d672728cc8b98ae18fa107d568

4 Likes