diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-07-28 04:02:52 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-07-28 04:02:52 +0900 |
| commit | 2c6f88109333855122d6b9624a0cd06c1de6422e (patch) | |
| tree | c7bfcda1d806b4cac1e2ec9c226a88350b23ce4a | |
| parent | クラスタ数を制限するオプションを追加 (diff) | |
| download | misskey-2c6f88109333855122d6b9624a0cd06c1de6422e.tar.gz misskey-2c6f88109333855122d6b9624a0cd06c1de6422e.tar.bz2 misskey-2c6f88109333855122d6b9624a0cd06c1de6422e.zip | |
管理者用パスワードリセットコマンドを実装
Diffstat (limited to '')
| -rw-r--r-- | cli/reset-password.js | 29 | ||||
| -rw-r--r-- | docs/manage.en.md | 5 | ||||
| -rw-r--r-- | docs/manage.ja.md | 5 |
3 files changed, 39 insertions, 0 deletions
diff --git a/cli/reset-password.js b/cli/reset-password.js new file mode 100644 index 0000000000..d94c90f3d5 --- /dev/null +++ b/cli/reset-password.js @@ -0,0 +1,29 @@ +const mongo = require('mongodb'); +const bcrypt = require('bcryptjs'); +const User = require('../built/models/user').default; + +const args = process.argv.slice(2); + +const user = args[0]; + +const q = user.startsWith('@') ? { + username: user.split('@')[1], + host: user.split('@')[2] || null +} : { _id: new mongo.ObjectID(user) }; + +console.log(`Resetting password for ${user}...`); + +const passwd = 'yo'; + +// Generate hash of password +const hash = bcrypt.hashSync(passwd); + +User.update(q, { + $set: { + password: hash + } +}).then(() => { + console.log(`Password of ${user} is now '${passwd}'`); +}, e => { + console.error(e); +}); diff --git a/docs/manage.en.md b/docs/manage.en.md index 9a4277b399..a7296ce479 100644 --- a/docs/manage.en.md +++ b/docs/manage.en.md @@ -29,6 +29,11 @@ node cli/suspend @syuilo node cli/suspend @syuilo@misskey.xyz ``` +## Reset password +``` shell +node cli/reset-password (User-ID or Username) +``` + ## Clean up cached remote files ``` shell node cli/clean-cached-remote-files diff --git a/docs/manage.ja.md b/docs/manage.ja.md index 924c567d14..f289037ad3 100644 --- a/docs/manage.ja.md +++ b/docs/manage.ja.md @@ -29,6 +29,11 @@ node cli/suspend @syuilo node cli/suspend @syuilo@misskey.xyz ``` +## ユーザーのパスワードをリセットする +``` shell +node cli/reset-password (ユーザーID または ユーザー名) +``` + ## キャッシュされたリモートファイルをクリーンアップする ``` shell node cli/clean-cached-remote-files |