Source code for odoo_xmlrpc_twisted.functions.check_user_login

"""
Validate if login and password are correct.
"""



# call the function "get_settings_odoo" to get the parameters
# for the logging of the model on the "odoo Webservice API"
try:
    from .get_settings_odoo import get_settings_odoo
except ImportError:
    from get_settings_odoo import get_settings_odoo
result       = get_settings_odoo()
db           = result[0]
uid          = result[1]
odoo_password = result[3]
models       = result[4]
common       = result[5]


    
[docs] def check_user_login(login, password): """ Function to validate if a user's login and password are correct. The user must be activated ('x_activate_complete') and a Portal User. Gives back as the result 'True' or 'False'. """ result = 'False' # check if login and password are valid result_user = common.authenticate(db, login, password, {}) if result_user: # check if the user is activated and is a Portal User user_id = models.execute_kw(db, uid, odoo_password, 'res.users', 'search', [[('login', '=', login), ('x_activate_complete', '=', True), ('share', '=', True), ]]) if user_id: result = 'True' else: result = 'False' else: result = 'False' return(result)