From 29a534bb8157a5f805a96dddfbf6c6835db65b8a Mon Sep 17 00:00:00 2001 From: Alex van Vucht Date: Sat, 6 Jan 2018 09:30:26 +0000 Subject: [PATCH] OpenID Connect specs say the username is 'preferred_username' not 'user_name' so let's go with the latter if we can't find 'user_name' --- lib/redmine_openid_connect/account_controller_patch.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/redmine_openid_connect/account_controller_patch.rb b/lib/redmine_openid_connect/account_controller_patch.rb index 96a924c..60f49ef 100644 --- a/lib/redmine_openid_connect/account_controller_patch.rb +++ b/lib/redmine_openid_connect/account_controller_patch.rb @@ -105,7 +105,11 @@ def oic_local_login if user.nil? user = User.new - user.login = user_info["user_name"] + if user_info["user_name"].present? + user.login = user_info["user_name"] + else + user.login = user_info["preferred_username"] + end attributes = { firstname: user_info["given_name"],