Adding workaround for backward compatibility with legacy LDAP users
This commit is contained in:
parent
fa5a53f5ed
commit
ad265b9610
1 changed files with 6 additions and 1 deletions
|
@ -95,8 +95,13 @@ class User < ActiveRecord::Base
|
||||||
|
|
||||||
if @user = User.find_by_extern_uid_and_provider(uid, provider)
|
if @user = User.find_by_extern_uid_and_provider(uid, provider)
|
||||||
@user
|
@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
|
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
|
password = Devise.friendly_token[0, 8].downcase
|
||||||
@user = User.create(
|
@user = User.create(
|
||||||
:extern_uid => uid,
|
:extern_uid => uid,
|
||||||
|
|
Loading…
Reference in a new issue