Does anyone know how I’d run plain text passwords through the authlogic hasing algorithm without using rails? It looks like the default for authlogic is sha512.
I have a database of plain text passwords (yes, I know… bad) and need to import them into a new DB that uses the authlogic setup.
This ruby script is outside of rails so I don’t want to use the rails based authlogic commands.
I have
require ‘authlogic’
in the ruby script
I’m new to ruby modules but was trying to call the password method like:
Authlogic::ActsAsAuthentic::Password::Methods::InstanceMethods.password(‘password_here’)
I got a ‘no password method’ error from that, but there is a ‘password’ method under that stack of modules in the authlogic code.
Thanks!
I wouldn’t just try and import them straight up, because remember you’ll probably need to create the “salt” as well. You should just create a whole new “user” for each of your current ones:
and that way you’ll know it’s doing it the way authlogic intended. And as long as your User model is using authlogic, it’ll use authlogic’s methods to save the passwords.