Skip to content

howto login as user

compwron edited this page Dec 22, 2021 · 1 revision

howto login as user if you have prod db access

user = User.find_by_email(email)
user.patterns.count # 9
real_pass = user.encrypted_password
me = User.find_by_email(my_prod_email)
my_pass = me.encrypted_password
user.update!(encrypted_password: my_pass) # make it possible for me to log into the user's account without knowing or changing their password 
user.update!(encrypted_password: real_pass) # put the user's password back the way it was
Clone this wiki locally