wefra-odoo11/models/my-profile.php

26 lines
961 B
PHP
Raw Normal View History

2019-10-02 21:28:58 +00:00
<?php
$oConf = new ClassConfig();
if(!isset($_SESSION['user'])){ header("location:".$oConf->getURLRoot()); }
$oUser = new ClassUserCustom();
$url = $_SESSION['erp']['url'];
$db = $_SESSION['erp']['db'];
//$username = $_SESSION['erp']['admin_user'];
//$password = $_SESSION['erp']['admin_password'];
$username = $_SESSION['user']['email'];
$password = $_SESSION['user']['password'];
$common = ripcord::client($url."xmlrpc/2/common");
$uid = $common->authenticate($db, $username, $password, array());
$models = ripcord::client($url."xmlrpc/2/object");
$userPassword = array();
if(isset($_POST['submit_change_password'])){
$userPassword = $oUser->changePassword($_SESSION['user']['id'], $_POST);
print_r($userPassword);
$getUser = $oUser->getUser($_SESSION['user']['id']);
$models->execute_kw($db, $uid, $password, 'res.users', 'write', array(array($getUser['ext_id']), array('password'=>$getUser['password'])));
}
$user = $_SESSION['user']['erp'][0];