I have a custom SSO solution and when I get a new member I manually create a Discourse user for them with the same email as they have set themselves in the other system. For this I use a simple piece of code which runs
User.create! and sets a few settings. This has worked perfectly a few hundred times since I began doing it earlier this year. But since about a week it does not work anymore, all new users since then have reported that they are unable to login to Discourse.
Today I finally figured out that the issue is probably due to the email addresses not being set properly. When I inspect the most recently created users, their emails are nil. However, strangely enough their emails are visible from the Discourse admin interface (this made the issue hard to identify—since I could see the email addresses from the GUI, I assumed that they were saved correctly).
When I try to set their email addresses manually (
user.email = "..."; user.save), at first looks as if it works, but the user object still has the email attribute set to nil.
Could this possibly have to do with email verification or some such? Has something new along those lines been introduced or modified recently?
In any case, I need a way to create new accounts which also sets email addresses. What is the best way of doing this?