bitnami版 redmineのパスワード強制変更(Windows)


参考サイト

概要

  • Redmineはrailsで作らていて、パスワードは Userテーブルのpasswordに保存されている。
  • 対象ユーザーレコードのpasswordを更新することで、パスワードを変更する。

コンソールの起動

  • Bitnami Redmine Stack を起動

パスワードの変更

  • htdocsフォルダに移動
C:\Bitnami\redmine-4.0.1-0>cd apps/redmine/htdocs
C:\Bitnami\redmine-4.0.1-0\apps\redmine\htdocs>
  • railsコンソールにログイン
C:\Bitnami\redmine-4.0.1-0\apps\redmine\htdocs>ruby bin/rails console production
Beginning in Rails 4, Rails ships with a `rails` binstub at ./bin/rails that
should be used instead of the Bundler-generated `rails` binstub.
 :
DEPRECATION WARNING: Passing the environment's name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -e option instead. (called from load at bin/rails:16)
Loading production environment (Rails 5.2.2)
irb(main):001:0>
  • 任意の変数tempUser に対象ユーザーのレコードをセット
irb(main):001:0> tempUser = User.find_by_login('対象ユーザーのログインID')
=> #<User id: 1, login: "対象ユーザーのログインID", hashed_password: "6d03efcf4c2c21b7c564d2fee4c98f3deaa85fca", firstname: "xxxxx", lastname: "xxxxx", admin: true, status: 1, last_login_on: "2019-02-26 01:50:38", language: "ja", auth_source_id: nil, created_on: "2019-01-24 05:32:19", updated_on: "2019-02-26 01:49:16", type: "User", identity_url: nil, mail_notification: "all", salt: "471c595ab17d7f1f781ade3401611bc8", must_change_passwd: false, passwd_changed_on: "2019-02-26 01:45:57">
irb(main):002:0>
  • tempUser.passwordに新しいパスワードをセット
irb(main):002:0> tempUser.password = '新しいパスワード'
=> "新しいパスワード"
irb(main):003:0>
  • 更新した対象ユーザのレコードをコミット
irb(main):003:0> tempUser.save!
=> true
irb(main):004:0>

以上