I currently have a site (Rails 4.1, ActiveRecord, Postgres) where a visitor can log in to one of multiple models — for example, a visitor can create an account or login as a User
, Artist
, etc. Each of these models have a password_digest
column (using bcrypt
and has_secure_password
).
Now we want to move to the site to a unified login system — everyone creates and logs in as a User
, and a User
can belong to an Artist
and the other models we have.
I think it makes sense to directly use the password_digest
column in the User
table, rather than looking across all the existing models. This means we'll have to create new entries in the User
table and copy the password_digest
s into them.
Can this be safely done, and would everyone be able to login with the password they already have? I've tried playing around with password_digest
s in the Rails console (copying digests to known passwords and assigning them to other entries) and it appears to authenticate correctly … are there any downsides to doing this?