My bad - I'm doing too many things at once (the adusers table is something else I'm troubleshooting, so I confused myself, too!). Yes, the users table is for authentication and is what I'm importing into.
I have lots of validations in my users table, so that's where the issue probably is. I will run in development mode and post further if I get stuck. Thanks for the point in the right direction. On Tuesday, November 27, 2012 10:24:10 AM UTC-8, Benjamin Wanicur wrote: > > Your original post said you were importing data into your users table, but > your script was importing into the adusers table. And it appears only the > users table has validation. So, I am not clear how your code works in > terms of which model is being used for authentication / login. > > Without getting into all of that, the easy answer here is run this in > Development mode! You should get a nice stack track in your logs. > Hopefully you are running this locally or in a closed environment where > stack traces can be examined without being persisted into the > interwebsasphere. :) > > > On Tue, Nov 27, 2012 at 1:14 PM, KT <[email protected] <javascript:>>wrote: > >> 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]> 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] >>>> 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
