diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 971181d14a1..97f1f1a1735 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -1085,6 +1085,9 @@ class Database(http.Controller): @http.route('/web/database/create', type='http', auth="none", methods=['POST'], csrf=False) def create(self, master_pwd, name, lang, password, **post): + insecure = odoo.tools.config.verify_admin_password('admin') + if insecure and master_pwd: + dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd]) try: if not re.match(DBNAME_PATTERN, name): raise Exception(_('Invalid database name. Only alphanumerical characters, underscore, hyphen and dot are allowed.')) @@ -1099,6 +1102,9 @@ class Database(http.Controller): @http.route('/web/database/duplicate', type='http', auth="none", methods=['POST'], csrf=False) def duplicate(self, master_pwd, name, new_name): + insecure = odoo.tools.config.verify_admin_password('admin') + if insecure and master_pwd: + dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd]) try: if not re.match(DBNAME_PATTERN, new_name): raise Exception(_('Invalid database name. Only alphanumerical characters, underscore, hyphen and dot are allowed.')) @@ -1111,6 +1117,9 @@ class Database(http.Controller): @http.route('/web/database/drop', type='http', auth="none", methods=['POST'], csrf=False) def drop(self, master_pwd, name): + insecure = odoo.tools.config.verify_admin_password('admin') + if insecure and master_pwd: + dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd]) try: dispatch_rpc('db','drop', [master_pwd, name]) request._cr = None # dropping a database leads to an unusable cursor @@ -1121,6 +1130,9 @@ class Database(http.Controller): @http.route('/web/database/backup', type='http', auth="none", methods=['POST'], csrf=False) def backup(self, master_pwd, name, backup_format = 'zip'): + insecure = odoo.tools.config.verify_admin_password('admin') + if insecure and master_pwd: + dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd]) try: odoo.service.db.check_super(master_pwd) ts = datetime.datetime.utcnow().strftime("%Y-%m-%d_%H-%M-%S") @@ -1139,6 +1151,9 @@ class Database(http.Controller): @http.route('/web/database/restore', type='http', auth="none", methods=['POST'], csrf=False) def restore(self, master_pwd, backup_file, name, copy=False): + insecure = odoo.tools.config.verify_admin_password('admin') + if insecure and master_pwd: + dispatch_rpc('db', 'change_admin_password', ["admin", master_pwd]) try: data_file = None db.check_super(master_pwd) diff --git a/addons/web/views/database_manager.html b/addons/web/views/database_manager.html index 4649366dd61..8d0d660ceb2 100644 --- a/addons/web/views/database_manager.html +++ b/addons/web/views/database_manager.html @@ -28,8 +28,10 @@ - {% macro master_input() -%} -
Warning, your Odoo database manager is not protected. To secure it, we have generated the following master password for it:
++
You can change it below but be sure to remember it, it will be asked for future operations on databases.
+