I have a PHP site where I want to login with the Odoo Credintials. How to do it?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Contabilitate
- Inventar
- PoS
- Project
- MRP
Această întrebare a fost marcată
I could login with the following code:
function create_passlib_pbkdf2($algo, $password, $salt, $iterations)
{
$hash = hash_pbkdf2($algo, $password, base64_decode(str_replace(".", "+", $salt)), $iterations, 64, true);
return sprintf("\$pbkdf2-%s\$%d\$%s\$%s", $algo, $iterations, $salt, str_replace("+", ".", rtrim(base64_encode($hash), '=')));
}
$rs = DB::Query("select password from res_users where login='".$username."'");
$data=$rs->fetchAssoc();
if($data)
{
$parts = explode('$', $data['password']);
if (!array_key_exists(4, $parts)) return false;
$t = explode('-', $parts[1]);if (!array_key_exists(1, $t)) return false;
$algo = $t[1];
$iterations = (int) $parts[2];
$salt = $parts[3];
$orghash = $parts[4];
$hash = create_passlib_pbkdf2($algo, $password, $salt, $iterations);
if($data['password'] == $hash) // if true then login successful
{
$password=$hash;
return true;
}
}
return false; // login failed
Hi,
You can refer this documentation: https://www.odoo.com/documentation/16.0/developer/reference/external_api.html where it explains how to validate the odoo user credentials from different language.
$url = ; $db = ; $username = "admin"; $password = for your admin user (default: admin)>;
require_once('ripcord.php'); $info = ripcord::client('https://demo.odoo.com/start')->start(); list($url, $db, $username, $password) = array($info['host'], $info['database'], $info['user'], $info['password']);
$common = ripcord::client("$url/xmlrpc/2/common"); $common->version();
$uid = $common->authenticate($db, $username, $password, array());
Thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Înscrie-te