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

Error while saving settings #1152

Closed
juanfalguera opened this issue Jan 11, 2016 · 11 comments
Closed

Error while saving settings #1152

juanfalguera opened this issue Jan 11, 2016 · 11 comments

Comments

@juanfalguera
Copy link

I just installed Teampass v 2.1.24.4 on Wampserver 3, running on Windows Server 2012.
The installation process was ok, with no errors. But, when I try to save any change in the Team Pass settings section I get this error:

Error:
Query: UPDATE teampass_misc SET valeur=NULL WHERE type = 'admin' AND intitule = 'ga_website_name'

I already tried to run on Wampserver 2, tried to use XAMPP but the same error persists. Any ideas?

Thanks.

@nilsteampassnet
Copy link
Owner

​Can you please make the next try.

In file sources/admin.queries.php, found:

        DB::query("SELECT * FROM ".prefix_table("misc")." WHERE type = %s
AND intitule = %s", "admin", "ga_website_name");
        $counter = DB::count();
        if ($counter == 0) {
            DB::insert(
                prefix_table("misc"),
                array(
                    'type' => "admin",
                    "intitule" => "ga_website_name",
                    'valeur' =>
htmlspecialchars_decode($dataReceived['ga_website_name'])
                )
            );
        } else {
            DB::update(
                prefix_table("misc"),
                array(
                    'valeur' =>
htmlspecialchars_decode($dataReceived['ga_website_name'])
                ),
                "type = %s AND intitule = %s",
                "admin",
                "ga_website_name"
            );
        }
        $_SESSION['settings']['ga_website_name'] =
htmlspecialchars_decode($dataReceived['ga_website_name']);
```​
​replace by
    if (!is_null($dataReceived['ga_website_name'])) {
        DB::query("SELECT * FROM ".prefix_table("misc")." WHERE type =

%s AND intitule = %s", "admin", "ga_website_name");
$counter = DB::count();
if ($counter == 0) {
DB::insert(
prefix_table("misc"),
array(
'type' => "admin",
"intitule" => "ga_website_name",
'valeur' =>
htmlspecialchars_decode($dataReceived['ga_website_name'])
)
);
} else {
DB::update(
prefix_table("misc"),
array(
'valeur' =>
htmlspecialchars_decode($dataReceived['ga_website_name'])
),
"type = %s AND intitule = %s",
"admin",
"ga_website_name"
);
}
$_SESSION['settings']['ga_website_name'] =
htmlspecialchars_decode($dataReceived['ga_website_name']);
} else {
$_SESSION['settings']['ga_website_name'] = "";
}

nilsteampassnet added a commit that referenced this issue Jan 11, 2016
Fixes for #1149, #1152
@juanfalguera
Copy link
Author

Sorry, it didn't work. Then I tried version 2.1.23.4 and now is working. Thanks.

@Dureaghin
Copy link

Didn't work for me too on version 2.1.24.

Apache/2.4.6 (CentOS 7)
MySQL 5.6.28
PHP 5.6.16

@nilsteampassnet
Copy link
Owner

I don't understand, I've retested on fresh 2.1.24(4) downloaded from Github and I cannot reproduce.
There must be a combination of settings on your instance that I cannot found.
Could you perform screenshots of tabs "Teampass Settings", "Customize" and "2FA Options"?
If you don't want to share you can send at nils@teampass.net

@juanfalguera
Copy link
Author

Here they are:

image
image
image
image
image

@nilsteampassnet
Copy link
Owner

nilsteampassnet commented Jan 12, 2016 via email

@juanfalguera
Copy link
Author

The error message appears on the screen:

image

@juanfalguera
Copy link
Author

I just ran this query on phpadmin and figured out that field "valeur" doesn't accept null values. I changed the structure to allow nulls and the error stoped. I don't know if this will result in other problems in the future, but it is working so far.

@juanfalguera
Copy link
Author

Another information that could help to identify the problem. I have to instances of Teampass running on the same server. Version 2.1.23 is running well and 2.1.24 wasn't. Then I compare the table teampass_misc to figure out what the property 'ga_website_name is about. I found that this property is about option "Name displayed Google Authenticator for Teampas" on the Tempass Settings screen. In version 2.1.23, this field exists:

image

In versions 2.1.24 it doesn't:

image

This is why version 2.1.24 is passing "null" to the field 'valeur' when you press "save"

@nilsteampassnet
Copy link
Owner

In file admin.settings.php, can you remove this:

    // Update ga_website_name
    if (isset($_SESSION['settings']['ga_website_name']) && $_SESSION['settings']['ga_website_name'] != @$_POST['ga_website_name']) {
        updateSettings('ga_website_name', @$_POST['ga_website_name']);
    }

@juanfalguera
Copy link
Author

It worked! Thanks!

nilsteampassnet added a commit that referenced this issue Jan 13, 2016
Fix for #1152, #1153, #1149 (partially)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants