From 599dbd035e409507fbfd2c64ca4bdb73c120b97a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 8 Jul 2016 10:45:46 +0200 Subject: [PATCH] Add option to reset admin password with trytond-admin issue5385 review23251003 --- CHANGELOG | 1 + trytond/admin.py | 2 +- trytond/commandline.py | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index cd04d128c4..cbdaf646a5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,4 @@ +* Add option to set admin password with trytond-admin * Remove super password * Remove database management from RPC * Remove ModelView.view_header_get diff --git a/trytond/admin.py b/trytond/admin.py index 3d9c38dacc..c01eef9394 100644 --- a/trytond/admin.py +++ b/trytond/admin.py @@ -54,7 +54,7 @@ def run(options): Module.update_list() for db_name in options.database_names: - if init[db_name]: + if init[db_name] or options.password: # try to read password from environment variable # TRYTONPASSFILE, empty TRYTONPASSFILE ignored passpath = os.getenv('TRYTONPASSFILE') diff --git a/trytond/commandline.py b/trytond/commandline.py index d4788f6a4e..81f52d84d3 100644 --- a/trytond/commandline.py +++ b/trytond/commandline.py @@ -46,12 +46,15 @@ def get_parser_admin(): metavar='MODULE', help="update a module") parser.add_argument("--all", dest="update", action="append_const", const="ir", help="update all installed modules") + parser.add_argument("-p", "--password", dest="password", + action='store_true', help="set the admin password") parser.add_argument("-m", "--update-modules-list", action="store_true", dest="update_modules_list", help="Update list of tryton modules") - parser.epilog = ('The first time a database is initialized admin ' - 'password is read from file defined by TRYTONPASSFILE ' - 'environment variable or interactively ask user.\n' + parser.epilog = ('The first time a database is initialized ' + 'or when the password is set, the admin password is read ' + 'from file defined by TRYTONPASSFILE environment variable ' + 'or interactively asked from the user.\n' 'The config file can be specified in the TRYTOND_CONFIG ' 'environment variable.\n' 'The database URI can be specified in the TRYTOND_DATABASE_URI '