mirror of
https://github.com/discourse/discourse.git
synced 2025-06-01 09:08:10 +08:00
FIX: display warning when SSO email is different from invite email (#13804)
In this commit, we skipped frontend validation when email is obfuscated: https://github.com/discourse/discourse/commit/534008ba24c However, if email from SSO is different from email from invite, we should still display warning.
This commit is contained in:

committed by
GitHub

parent
7162ecfb04
commit
40f6ceb6f2
@ -50,10 +50,13 @@ class InvitesController < ApplicationController
|
||||
email = Email.obfuscate(invite.email)
|
||||
|
||||
# Show email if the user already authenticated their email
|
||||
different_external_email = false
|
||||
if session[:authentication]
|
||||
auth_result = Auth::Result.from_session_data(session[:authentication], user: nil)
|
||||
if invite.email == auth_result.email
|
||||
email = invite.email
|
||||
else
|
||||
different_external_email = true
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,6 +76,10 @@ class InvitesController < ApplicationController
|
||||
email_verified_by_link: email_verified_by_link
|
||||
}
|
||||
|
||||
if different_external_email
|
||||
info[:different_external_email] = true
|
||||
end
|
||||
|
||||
if staged_user = User.where(staged: true).with_email(invite.email).first
|
||||
info[:username] = staged_user.username
|
||||
info[:user_fields] = staged_user.user_fields
|
||||
|
Reference in New Issue
Block a user