diff options
| author | IT Fixcomart <it@fixcomart.co.id> | 2022-11-04 10:37:56 +0700 |
|---|---|---|
| committer | IT Fixcomart <it@fixcomart.co.id> | 2022-11-04 10:37:56 +0700 |
| commit | 01d31b1c5c1324fbae3a29a5511012711a40472b (patch) | |
| tree | 193af31a6a3085f4ac893c4bef340cada333e3aa /indoteknik_api/controllers/controller.py | |
| parent | 015a2ff44f8286c36dc2c2b6dd236ddfa40ebeba (diff) | |
http authorization error when null
Diffstat (limited to 'indoteknik_api/controllers/controller.py')
| -rw-r--r-- | indoteknik_api/controllers/controller.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py index 9d0ff64e..a085d084 100644 --- a/indoteknik_api/controllers/controller.py +++ b/indoteknik_api/controllers/controller.py @@ -22,7 +22,10 @@ class Controller(http.Controller): request.session.authenticate(db, username, password) return True except: - authorization = wsgienv['HTTP_AUTHORIZATION'] or None + try: + authorization = wsgienv['HTTP_AUTHORIZATION'] + except: + authorization = None token = request.env['ir.config_parameter'].sudo().get_param('rest_api_token') or '' if authorization == token: request.session.authenticate(config.get('db_name'), 'it@fixcomart.co.id', 'Fixcomart378') |
