Revert "Samir aladawi fix database should be in conf"

This commit is contained in:
SamirLADOUI-sa 2024-08-05 10:18:25 +01:00 committed by GitHub
parent 0baec97977
commit dd28aaea89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 24 additions and 24 deletions

View File

@ -74,15 +74,15 @@ class WebController(http.Controller):
_logger.info(util.path("lokate", "static", "img", image))
return open(util.path("lokate", "static", "img", image), "rb").read()
# @http.route('/web/session/authenticate', type='json', auth="none")
# def authenticate(self, login, password, base_location=None):
# db = odoo.tools.config.get('db_name')
# if not db:
# response_data = {
# "error": "Database name should be specified in Conf File",
# "status": 400
# }
# return response_data
@http.route('/web/session/authenticate', type='json', auth="none")
def authenticate(self, login, password, base_location=None):
db = odoo.tools.config.get('db_name')
if not db:
response_data = {
"error": "Database name should be specified in Conf File",
"status": 400
}
return response_data
# request.session.authenticate(db, login, password)
# return request.env['ir.http'].session_info()
request.session.authenticate(db, login, password)
return request.env['ir.http'].session_info()

View File

@ -1,3 +1,3 @@
from . import authentication
# from . import web
from . import web

View File

@ -3,16 +3,16 @@ from odoo import http
from odoo.http import request
# class WebController(http.Controller):
# @http.route('/web/session/authenticate', type='json', auth="none")
# def authenticate(self, login, password, base_location=None):
# db = odoo.tools.config.get('db_name')
# if not db:
# response_data = {
# "error": "Database name should be specified in Conf File",
# "status": 400
# }
# return response_data
class WebController(http.Controller):
@http.route('/web/session/authenticate', type='json', auth="none")
def authenticate(self, login, password, base_location=None):
db = odoo.tools.config.get('db_name')
if not db:
response_data = {
"error": "Database name should be specified in Conf File",
"status": 400
}
return response_data
# request.session.authenticate(db, login, password)
# return request.env['ir.http'].session_info()
request.session.authenticate(db, login, password)
return request.env['ir.http'].session_info()