Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # use mongoid
- class User
- include Mongoid::Document
- end
- # then
- user = User.where(email: 'joe@example.com').first
- if user
- user.password = new_password
- user.password_confirmation = new_password
- user.save
- end
- # $ rails console production
- u=User.where(:email => 'usermail@gmail.com').first
- u.password='userpassword'
- u.password_confirmation='userpassword'
- u.save!
- User.find_by(email: 'user_email_address').reset_password!('new_password','new_password')
- u = User.find_by_email('user@example.com')
- u.update_attribute(:password, '123123')
- user = User.where(:email => email).first
- user = User.find_by_email('user@example.com')
- $ sudo bundle exec rails console production
- irb(main):001:0> user = User.where("username = 'root'")
- irb(main):002:0> u = user.first
- irb(main):003:0> u.password="root2014@Robin"
- => "root2014@Robin"
- irb(main):004:0> u.password_confirmation="root2014@Robin"
- => "root2014@Robin"
- irb(main):005:0> u.save
- => true
- irb(main):006:0> exit
- user.locked_at = ''
- user.failed_attempts = '0'
- user.save!
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement