[FIX] base_import_module: CSRF handling
* disabled CSRF protection for login route * return CSRF token from login and retransmit it during module upload ``deploy`` only sends CSRF token if given one by authenticate so that the command can be used for non-updated modules. Closes #9488
This commit is contained in:
committed by
Olivier Dony
parent
33299fd689
commit
045b9019ef
@@ -21,7 +21,7 @@ class ImportModule(Controller):
|
||||
if not is_admin:
|
||||
raise openerp.exceptions.AccessError("Only administrators can upload a module")
|
||||
|
||||
@route('/base_import_module/login', type='http', auth='none', methods=['POST'])
|
||||
@route('/base_import_module/login', type='http', auth='none', methods=['POST'], csrf=False)
|
||||
@webservice
|
||||
def login(self, login, password, db=None):
|
||||
if db and db != request.db:
|
||||
@@ -30,7 +30,9 @@ class ImportModule(Controller):
|
||||
if not uid:
|
||||
return Response(response="Wrong login/password", status=401)
|
||||
self.check_user(uid)
|
||||
return "ok"
|
||||
return Response(headers={
|
||||
'X-CSRF-TOKEN': request.csrf_token(),
|
||||
})
|
||||
|
||||
@route('/base_import_module/upload', type='http', auth='user', methods=['POST'])
|
||||
@webservice
|
||||
|
||||
Reference in New Issue
Block a user