Skip to content
Snippets Groups Projects
Commit fbe02409 authored by Andrej Shadura's avatar Andrej Shadura Committed by Sjoerd Simons
Browse files

Repeat SSO user lookup by emails in username/nickname fields


When logging in with e.g. OpenID Connect/Azure, two email addresses
may be provided, one in "email" field and another in "username" or
"nickname". Since this is exactly the opposite of what the separate
Azure backend does, migration from Azure to OpenID Connect/Azure
needs to try both emails which may be different.

Signed-off-by: Andrej Shadura's avatarAndrej Shadura <andrew.shadura@collabora.co.uk>
parent c201aa35
Branches
No related tags found
1 merge request!42Repeat SSO user lookup by emails in username/nickname fields
Pipeline #43862 passed
...@@ -233,6 +233,17 @@ class User < ApplicationRecord ...@@ -233,6 +233,17 @@ class User < ApplicationRecord
return user return user
end end
username = auth['username'] || auth['nickname']
if username.include? '@'
user = find_by_email(username)
if user
user.mark_login!
return user
end
end
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment