mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
parent
e96a5338e2
commit
f44e6e5ca5
1 changed files with 2 additions and 2 deletions
|
|
@ -11,13 +11,13 @@ module Users
|
|||
|
||||
def handle(provider)
|
||||
auth_hash = request.env['omniauth.auth']
|
||||
uid = auth_hash[:uid]
|
||||
username = auth_hash.info.email.split('@')[0]
|
||||
openid = Openid.find_for_oauth(auth_hash) # Get or create openid
|
||||
# If openid exists and is associated with a user, sign in with associated user,
|
||||
# even if the email of the associated user and the email of the provided openid are different
|
||||
unless (user = openid.user)
|
||||
user = User.find_for_auth(auth_hash, current_user) # Get or create users
|
||||
user.username = "#{uid}@#{provider}" if user.username.blank?
|
||||
user.username = "#{username}@#{provider}" if user.username.blank?
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue