I have one very active user on my discourse. Everything was fine until a moment when user changed surname and changed his email account. He logged on to discourse thu google authorisation. He changed his email in profile however linked google profile is pointing to an old google account and therefore he got 500 error as in profile email is new but linked google profile is pointing to an old email .
Previously, i just leaved this and described to user that it can’t be done. User changed email on github, logged in thru github and somehow it was connect to original account. However users still asking how to overcome this as they don’t like to lose profiles with history, bookmarks, badges, etc.
Another case, user was using discourse from work and he was logging in thru company google email for a couple of years. Now he quit, don’t have access to company email and he would like to use his personal google account for this profile with previous history, bookmarks, etc.
Maybe there is a case to make some fix directly in db? Any ideas?
The problem is that emails are not matched in email user field and in connected google account therefore user got 500 error during google authorization. Need to change “connected google account” somehow or clean “connected google account” so user can connect right google account. In UI i don’t see such option. I hope you understand what i meant
Hi, I have a related issue where we need to change the email for a user account in Discourse. I understand I can do this as Admin. This generates a confirmation email to the old email address. The problem is the old email address is no longer a valid address so we are getting Delivery Failure notices.
I saw this post by Kane York- part time developer on Jan '15
“I think you can change it at the external site, then have them log out/log in again? I think that will resync the email address”
Does this mean if I have the user on hand to log in as soon as I reset their password, we can bypass the email confirmation issue?
That was in reference to native SSO, not OAuth logins. It sounds like there’s something different between the Github and Google authenticators causing this issue.
For future reference, if a user runs into this problem when logging in on an iPad, they get a purely white screen with no error message or any sort of indication of a problem.
After some time the User got re-activated in Google Apps (different email address)
We reactivated the account on Discourse as well
User attempts to log in with Google SSO
The process fail with 500 Error
Seems to me that this is caused by blindly trying to create a new record, instead of updating an existing one if that is there (or maybe blindly deleting/creating will work as well)
Not entirely sure how that part works, but the main issue is that a GoogleUserInfo record is created for a certain user id, while such a record already exists, causing a unique key violation on user_id.
user_info = ::GoogleUserInfo.find_by(user_id: result.user.id)
if user_info
# update the record, dunno how that would look like
else
::GoogleUserInfo.create({ user_id: result.user.id }.merge(google_hash))
end
or alternatively something like (blindly delete scenario)
when the user changes their email, scrub their GoogleUserInfo record if it exists. This avoids the common scenario of “I changed my email and now I can’t login via Google”
when there is a conflict, report a proper error with a useful way forward
EDIT: after further consideration, if the user can login to the Google account then they have access to the account’s email and could perform a local password reset to gain access (if enabled). So I don’t think we’re introducing any problems by scrubbing any existing GoogleUserInfo record if BOTH the google_user_id and email address are different.
Implemented as described - if the google account ID AND email changes, it’ll be replaced, but if only the account ID changes the user will get an error:
You should probably create a canonical set of directions for how to resolve the error if you’re going to be pointing people to this topic in the error message.