tuxis-ie / nsedit

DNS Editor working with PowerDNS's new API
GNU General Public License v2.0
199 stars 55 forks source link

Password Change not workin #144

Closed righter83 closed 7 years ago

righter83 commented 7 years ago

Hi

I'm not able to change the password via "About Me". I got no error in logs but after submit the form, there is still the old PW in the SQLite3-DB. If i change it via "Users" tab it is workin. I see also in the nsedit logfile, that there is no username, but I can see the username in the form:

via About Me: Updating password and/or settings for . Admin: 1

via Users: Updating password and/or settings for admin. Admin: 1

righter83 commented 7 years ago

I found the problem. You send the emailadress instead of the id. I've patched it the following way in includes/misc.php in function update_user:

if (is_numeric($id))
    {
        $q = $db->prepare('SELECT * FROM users WHERE id = ?');
        $q->bindValue(1, $id, SQLITE3_INTEGER);
        $result = $q->execute();
        $userinfo = $result->fetchArray(SQLITE3_ASSOC);
        $q->close();
        $username = $userinfo['emailaddress'];
    }
    else
    {
        $q = $db->prepare('SELECT * FROM users WHERE emailaddress = ?');
        $q->bindValue(1, $id, SQLITE3_TEXT);
        $result = $q->execute();
        $userinfo = $result->fetchArray(SQLITE3_ASSOC);
        $q->close();
        $username = $id;
        $id = $userinfo['id'];
    }
Kraeutergarten commented 7 years ago

I can confirm this bug.

tuxis-ie commented 7 years ago

This is fixed in 6be5f2f29c48756017d29c867f64ffe395a2d995