aoberegg / ep_user_pad

User-Management System for etherpad-lite
Apache License 2.0
5 stars 8 forks source link

Etherpad crashes when managing users & groups #4

Open quenenni opened 10 years ago

quenenni commented 10 years ago

Wonderful plugin you're doing. Thanks.

I had few problems while testing it:

[2014-04-08 00:46:42.466] [ERROR] console - ReferenceError: encryptPassword is not defined
    at exports.socketio.io.on.socket.on.sqlUpdate (/home/etherpad/node_modules/ep_user_pad/hooks.js:563:25)
    at createSalt (/home/etherpad/node_modules/ep_user_pad/hooks.js:101:5)
    at exports.socketio.io.on.socket.on.sqlUpdate (/home/etherpad/node_modules/ep_user_pad/hooks.js:562:21)
    at Query._callback (/home/etherpad/node_modules/ep_user_pad/hooks.js:323:13)
    at Query.Sequence.end (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/sequences/Sequence.js:75:24)
    at Query._handleFinalResultPacket (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/sequences/Query.js:143:8)
    at Query.EofPacket (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/sequences/Query.js:127:8)
    at Protocol._parsePacket (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Protocol.js:172:24)
    at Parser.write (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Parser.js:62:12)
    at Protocol.write (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Protocol.js:37:16)

I resolved that problem by defining the function encryptPassword without the 'settings' before the name.

encryptPassword = function (password, salt, cb) in hooks.js

[2014-04-08 02:04:44.972] [INFO] console - (debug) ep_user_pad: mySqlErrorHandler
[2014-04-08 02:04:44.981] [ERROR] console - ReferenceError: fileName is not defined
    at Query.mySqlErrorHandler (/home/etherpad/node_modules/ep_user_pad/hooks.js:61:9)
    at Query.EventEmitter.emit (events.js:123:20)
    at Query.Sequence.end (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/sequences/Sequence.js:70:12)
    at Query.ErrorPacket (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/sequences/Query.js:93:8)
    at Protocol._parsePacket (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Protocol.js:172:24)
    at Parser.write (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Parser.js:62:12)
    at Protocol.write (/home/etherpad/node_modules/ep_user_pad/node_modules/mysql/lib/protocol/Protocol.js:37:16)
    at Socket.ondata (stream.js:38:26)
    at Socket.EventEmitter.emit (events.js:123:20)
    at TCP.onread (net.js:396:14)

I can see that the group is removed from the table "Groups" in the DB.

quenenni commented 10 years ago

I found the problem for point 2 ( when I delete a group, my etherpad crashes).

When I imported the tables structure in my Db (via phpMyAdmin), I remembered having troubles because of the (sort of) single quotes surrounding the names.

In your pdf, we have:

‘GroupID‘

And we shoud have:

`GroupID`

Yours are different from mines and are wrong.

Now it works well..

WroDo commented 10 years ago

Hello,

I also manged to solve issue #2 after changing the ticks.

BUT, I still have issue #1, the one where encryptPassword is not defined. Can you tell me, what is missing?

Thank you!

Yours, WroDo

quenenni commented 10 years ago

Open the file ap_user_pad/hooks.js

Inside, find the function encryptPassword and remove the 'settings.' at the beginning.

encryptPassword = function (password, salt, cb) {
    var encrypted = crypto.createHmac('sha256', salt).update(password).digest('hex');
    cb(encrypted);
};

If it's still doen't work, can you verify you have the exact same error.

braaam commented 9 years ago

It's still happening when the plugin is installed through npm. Can this be updated?

braaam commented 9 years ago

Sorry, I meant the encryptPassword thing. The sql definition is also very awkward. Please add an .sql import file!