| ... | ... | @@ -67,15 +67,15 @@ class User < ActiveRecord::Base |
|
|
|
(0...8).map{ ('a'..'z').to_a[rand(26)] }.join
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.find_for_ldap_auth(omniauth)
|
|
|
|
username = omniauth.sAMAccountName[0]
|
|
|
|
email = omniauth.userprincipalname[0]
|
|
|
|
def self.find_for_ldap_auth(omniauth_info)
|
|
|
|
name = omniauth_info.name
|
|
|
|
email = omniauth_info.email
|
|
|
|
|
|
|
|
if @user = User.find_by_email(email)
|
|
|
|
@user
|
|
|
|
else
|
|
|
|
password = generate_random_password
|
|
|
|
@user = User.create(:name => username,
|
|
|
|
@user = User.create(:name => name,
|
|
|
|
:email => email,
|
|
|
|
:password => password,
|
|
|
|
:password_confirmation => password
|
| ... | ... | |
| ... | ... | |