From 3ad552602bea9fde41cee1d40fe6c551daa09658 Mon Sep 17 00:00:00 2001 From: Rob Colbert Date: Sun, 11 Aug 2019 19:10:16 +0000 Subject: [PATCH] how to manually change a user's password --- docs/password-reset.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/password-reset.md diff --git a/docs/password-reset.md b/docs/password-reset.md new file mode 100644 index 0000000..2af57e9 --- /dev/null +++ b/docs/password-reset.md @@ -0,0 +1,24 @@ +# Manually Resetting a User's Password + +Open a shell in your instance's environment and start an interactive Ruby +interpreter: + +```sh +cd ~/live +bin/rails c +``` + +In the Ruby shell, you are going to load the account record, load the user +record for that account, change the password for the User object, and save the +User object. + +``` +account = Account.find_by(username: 'username') +user = User.find_by(account: account) +user.password = '[new password]' +user.save! +``` + +The `save!` call will email the user that their password has been changed, but +they won't know their new password. The new password will have to be +communicated to the user in some way. \ No newline at end of file -- 2.22.0