Skip to content

Commit

Permalink
Merge pull request #620 from mbbsemu/improve-create-user-script
Browse files Browse the repository at this point in the history
Correct the name of the mbbsemu.db file; add message at the end reminding the user to recreate the BBSUSR database.
  • Loading branch information
paladine committed Jan 14, 2024
2 parents afdb974 + 0cc4fdb commit ef99d43
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/create_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def _create_parser():
parser.add_argument('--password', help='Password to use', required=True)
parser.add_argument('--keys', help='Account keys to add to the new account', action='append', default=['NORMAL','PAYING'])
parser.add_argument('--email', help='Email address to use', default='test@test.bbs')
parser.add_argument('--dbfile', help='Database specified by appsettings.json Database.File', default='mbbsemu.db')

return parser.parse_args()

Expand All @@ -25,7 +26,7 @@ def _make_password_hash(password, salt_bytes):
def _main():
args = _create_parser()

conn = sqlite3.connect('mbbs.db')
conn = sqlite3.connect(args.dbfile)

passwordSaltBytes=os.urandom(32)
passwordHashBytes=_make_password_hash(args.password, passwordSaltBytes)
Expand All @@ -42,5 +43,7 @@ def _main():
cur.execute('INSERT INTO AccountKeys (accountId, accountKey, createDate, updateDate) VALUES (?,?,datetime(\'now\'), datetime(\'now\'))', t)
conn.commit()

print("Database updated; now you need to go run MBBSEmu -CLI -DBREBUILD BBSUSR to rebuild the runtime user database.")

if __name__ == '__main__':
_main()

0 comments on commit ef99d43

Please sign in to comment.