FIX: skip email if blank while syncing SSO attributes. (#19939)

Also, return email blank error in `EmailValidator`  when the email is blank.
This commit is contained in:
Vinoth Kannan
2023-01-24 09:10:24 +05:30
committed by GitHub
parent 0924f874bd
commit 799202d50b
5 changed files with 31 additions and 2 deletions

View File

@ -1777,6 +1777,26 @@ RSpec.describe Admin::UsersController do
expect(user.username).to eq("Hokli")
end
it "can sync up with the sso without email" do
sso.name = "Bob The Bob"
sso.username = "bob"
sso.email = "bob@bob.com"
sso.external_id = "1"
user =
DiscourseConnect.parse(
sso.payload,
secure_session: read_secure_session,
).lookup_or_create_user
sso.name = "Bill"
sso.username = "Hokli$$!!"
sso.email = nil
post "/admin/users/sync_sso.json", params: Rack::Utils.parse_query(sso.payload)
expect(response.status).to eq(200)
end
it "should create new users" do
sso.name = "Dr. Claw"
sso.username = "dr_claw"