Commit ad265b96 authored by Jakub Jirutka's avatar Jakub Jirutka

Adding workaround for backward compatibility with legacy LDAP users

parent fa5a53f5
......@@ -95,8 +95,13 @@ class User < ActiveRecord::Base
if @user = User.find_by_extern_uid_and_provider(uid, provider)
@user
# workaround for backward compatibility
elsif @user = User.find_by_email(email)
logger.info "Updating legacy LDAP user #{email} with extern_uid => #{uid}"
@user.update_attributes(:extern_uid => uid, :provider => provider)
@user
else
logger.info "Creating user from LDAP login; uid = #{uid}, name = #{name}, email = #{email}"
logger.info "Creating user from LDAP login {uid => #{uid}, name => #{name}, email => #{email}}"
password = Devise.friendly_token[0, 8].downcase
@user = User.create(
:extern_uid => uid,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment