Ah, that makes sense.
Running in production mode.
*aduser.rb*
class Aduser < ActiveRecord::Base
def fullname
self.last_name + ", " + self.first_name
end
end
*user.rb*
acts_as_authentic do |c|
c.validate_password_field = false
end
protected
def valid_ldap_credentials?(password_plaintext)
ldap = Net::LDAP.new
ldap.host = 'ad.sannet.gov'
ldap.auth "AD\\" + self.username, password_plaintext
ldap.bind
end
*user_session.rb*
class UserSession < Authlogic::Session::Base
verify_password_method :valid_ldap_credentials?
end
On Tuesday, November 27, 2012 9:39:45 AM UTC-8, Benjamin Wanicur wrote:
>
> Ok. I would suggest not importing these data directly into the DB. You
> are bypassing Rails when you do that, and it seems that the data is somehow
> failing Rails validation until you save the record in console. To know
> that for sure, could you post your AdUser model and any authentication code
> from Rails (you mentioned using net-ldap authentication) ?
>
> If you were to import your data using a Ruby script (maybe a rake task or
> even in console), you would get the errors up front and there would
> probably be less mystery. Also, if you are truly seeing nothing in the
> logs, you might check your error level. Are you running this in
> development mode ?
>
>
> On Tue, Nov 27, 2012 at 12:30 PM, KT <[email protected] <javascript:>>wrote:
>
>> Here's my script:
>>
>> TRUNCATE adusers;
>>
>> LOAD DATA INFILE '/home/kt/scripts/adusers.csv' INTO TABLE adusers
>> FIELDS TERMINATED BY ',' ENCLOSED BY '"'
>> IGNORE 1 LINES
>> (first_name, last_name, username);
>>
>> update adusers
>> set first_name = CONCAT(UCASE(SUBSTRING(`first_name`, 1,
>> 1)),LOWER(SUBSTRING(`first_name`, 2)));
>>
>> update adusers
>> set last_name = CONCAT(UCASE(SUBSTRING(`last_name`, 1,
>> 1)),LOWER(SUBSTRING(`last_name`, 2)));
>>
>> UPDATE adusers SET username = lower(username);
>>
>>
>>
>> On Tuesday, November 27, 2012 9:24:45 AM UTC-8, Benjamin Wanicur wrote:
>>
>>> Hi KT
>>>
>>> Can you post the code that imports your users via CSV ?
>>>
>>>
>>> On Tue, Nov 27, 2012 at 12:11 PM, KT <[email protected]> wrote:
>>>
>>>> Strange issue - I am importing users into a user table via csv.
>>>>
>>>> In my Rails app interface, I can view the new users. However, when the
>>>> imported users attempt to login, they cannot ("Something went wrong", but
>>>> no errors in log).
>>>>
>>>> If I use the interface to manually save their user record (making no
>>>> changes) they can suddenly login. If I create the new users through the
>>>> interface, they can login. I am using net-ldap authentication.
>>>>
>>>> Why would imported users not be able to login without manual
>>>> interaction to the record?
>>>>
>>>> --
>>>> SD Ruby mailing list
>>>> [email protected]
>>>> http://groups.google.com/**group/sdruby<http://groups.google.com/group/sdruby>
>>>
>>>
>>> --
>> SD Ruby mailing list
>> [email protected] <javascript:>
>> http://groups.google.com/group/sdruby
>>
>
>
--
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby