Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I am working with OpenERP 7. I want to know how can I log in the server by just passing connection parameters in the URL (db, login, password).
Any idea how can we do that ?
Check the module web, it defines the login form and js files etc, check also the file res_users.py in module base/res/ and there is the login function defined.
def login(self, db, login, password): if not password: return False user_id = False cr = pooler.get_db(db).cursor() try: # autocommit: our single update request will be performed atomically. # (In this way, there is no opportunity to have two transactions # interleaving their cr.execute()..cr.commit() calls and have one # of them rolled back due to a concurrent access.) cr.autocommit(True) # check if user exists res = self.search(cr, SUPERUSER_ID, [('login','=',login)]) if res: user_id = res # check credentials self.check_credentials(cr, user_id, password) # We effectively unconditionally write the res_users line. # Even w/ autocommit there's a chance the user row will be locked, # in which case we can't delay the login just for the purpose of # update the last login date - hence we use FOR UPDATE NOWAIT to # try to get the lock - fail-fast # Failing to acquire the lock on the res_users row probably means # another request is holding it. No big deal, we don't want to # prevent/delay login in that case. It will also have been logged # as a SQL error, if anyone cares. try: cr.execute("SELECT id FROM res_users WHERE id=%s FOR UPDATE NOWAIT", (user_id,), log_exceptions=False) cr.execute("UPDATE res_users SET login_date = now() AT TIME ZONE 'UTC' WHERE id=%s", (user_id,)) except Exception: _logger.debug("Failed to update last_login for db:%s login:%s", db, login, exc_info=True) except openerp.exceptions.AccessDenied: _logger.info("Login failed for db:%s login:%s", db, login) user_id = False finally: cr.close() return user_id
and check the methods authenticate, check and check_credentials also.
About This Community
This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 11/14/13, 8:39 AM|
|Seen: 13895 times|
|Last updated: 10/11/16, 10:58 AM|