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_odooimportget_settings_odooexceptImportError:fromget_settings_odooimportget_settings_odooresult=get_settings_odoo()db=result[0]uid=result[1]odoo_password=result[3]models=result[4]common=result[5]
[docs]defcheck_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 validresult_user=common.authenticate(db,login,password,{})ifresult_user:# check if the user is activated and is a Portal Useruser_id=models.execute_kw(db,uid,odoo_password,'res.users','search',[[('login','=',login),('x_activate_complete','=',True),('share','=',True),]])ifuser_id:result='True'else:result='False'else:result='False'return(result)