Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user is not synced #43

Open
de-received opened this issue Jan 28, 2020 · 2 comments
Open

user is not synced #43

de-received opened this issue Jan 28, 2020 · 2 comments

Comments

@de-received
Copy link

de-received commented Jan 28, 2020

Hello,

We have an issue with user syncing. If we create a order on whmcs we get an api error response with the message "User is not synced!" In the log we can find the following error:

Easy-Wi.com API Response: "action"=>"fail","actionSend"=>"add","username"=>"u0","external_id"=>":3","email"=>"[email protected]","errors"=>"Could not write user to database","password"=>"","active"=>"Y","localid"=>"0","vname"=>"Max","name"=>"Mustermann","phone"=>"","handy"=>"","fax"=>"","city"=>"Musterstadt","cityn"=>"","street"=>"Musterstrasze","streetn"=>"1","salutation"=>"","birthday"=>"","country"=>"de","fdlpath"=>"","mail_backup"=>"Y","mail_gsupdate"=>"Y","mail_securitybreach"=>"Y","mail_serverdown"=>"Y","mail_ticket"=>"Y","mail_vserver"=>"Y",

In the whmcs database in the table mod_easywi_user_synced we can confirm the user with synced flag = N.

So my questions, why can the user not be write to the database?

Thank you for your help!

Regards,

@de-received
Copy link
Author

de-received commented Jan 29, 2020

Hello again,

I have found the code in the file stuff/api/api_users.php where we get the error message "Could not write user to database".

`
if (!isset($success) and isset($insert) and $insert == true) {

        $password = (!isset($data['password']) or in_array($data['password'], $bad)) ? passwordgenerate(10) : $data['password'];

        $newHash = passwordCreate($name, $password);

        if (is_array($newHash)) {

            $query = $sql->prepare("UPDATE `userdata` SET `cname`=?,`security`=?,`salt`=? WHERE `id`=? LIMIT 1");
            $query->execute(array($username, $newHash['hash'], $newHash['salt'], $localID));

        } else {

            $query = $sql->prepare("UPDATE `userdata` SET `cname`=?,`security`=? WHERE `id`=? LIMIT 1");
            $query->execute(array($username, $newHash, $localID));

        }


        $query = $sql->prepare("INSERT INTO `userdata_groups` (`userID`,`groupID`,`resellerID`) VALUES (?,?,?)");
        foreach ($userGroupIDs as $groupID) {
                            $query->execute(array($localID, $groupID, $resellerID));
                    }

    } else if (!isset($success)) {
        $success['false'][] = 'Could not write user to database';
    }

`

But I don't know why the User can not be generated. Can someone explain me the function?

Thank you in advance!

Regards!

@AEon-Jan
Copy link
Member

AEon-Jan commented Mar 17, 2020

Sounds like a bug to me....

Are you able to Access the Database from Both Sides?
Is the Password / IP correct?
Is the User able to Write in the DB?

I checked that issue Yesterday with the Current versions, and it worked like it should.

EDIT: I know why this issue is cooming up...
Try to Create the user by hand in the easywi with the same data like in the WHMCS ...
I Tested it and he WHMCS accepted my Testing Email ... BUT EasyWI Rejected it ... so he Responded that issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants