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

New Install gives me object encoding error #6

Open
reduxdj opened this issue Sep 1, 2013 · 9 comments
Open

New Install gives me object encoding error #6

reduxdj opened this issue Sep 1, 2013 · 9 comments

Comments

@reduxdj
Copy link

reduxdj commented Sep 1, 2013

Brubeck going down...
(listsurf)quadcore-imac:listsurf dj$ ./listsurf.py
INFO:root:Using coroutine library: eventlet
Brubeck v0.4.0 online ]-----------------------------------
ERROR:root:Credentials failed
ERROR:root:Unicode-objects must be encoded before hashing
INFO:root:200 POST /create (127.0.0.1)

@j2labs
Copy link
Owner

j2labs commented Sep 1, 2013

Please provide more informationsoI can reproduce.

On Saturday, August 31, 2013, Patrick Lemiuex wrote:

Brubeck going down...
(listsurf)quadcore-imac:listsurf dj$ ./listsurf.py
INFO:root:Using coroutine library: eventlet
Brubeck v0.4.0 online ]-----------------------------------
ERROR:root:Credentials failed
ERROR:root:Unicode-objects must be encoded before hashing
INFO:root:200 POST /create (127.0.0.1)


Reply to this email directly or view it on GitHubhttps://github.com//issues/6
.

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

I started the server, and tried to post an object to the handler. Then the error came up. Not sure, but I don't get any errors in the template, I don't know what ERROR:root:Credentials failed -- mongodb issue?

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

HTH:

Sun, 01 Sep 2013 03:14:50 GMT [ERROR](src/unixy.c:55: errno: Operation not permitted) Can't chroot to ./, rerun as root if this is what you want.
Sun, 01 Sep 2013 03:14:50 GMT [WARN](src/mongrel2.c:243: errno: None) Couldn't chroot too ./, assuming running in test mode.
Sun, 01 Sep 2013 03:14:50 GMT INFO Starting 0MQ with 1 threads.
Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.header_count=1280
Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.content_length=20480, limits.buffer_size=4096, limits.connection_stack_size=32768, limits.client_read_retries=5
Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10
Sun, 01 Sep 2013 03:14:50 GMT INFO MAX limits.fdtask_stack=102400
Sun, 01 Sep 2013 03:14:50 GMT INFO MAX allowing limits.handler_targets=128
Sun, 01 Sep 2013 03:14:50 GMT INFO Binding handler PUSH socket tcp://127.0.0.1:9999 with identity: 34f9ceee-cd52-4b7f-b197-88bf2f0ec378
Sun, 01 Sep 2013 03:14:50 GMT INFO Binding listener SUB socket tcp://127.0.0.1:9998 subscribed to:
Sun, 01 Sep 2013 03:14:50 GMT INFO Setting up control socket in at ipc://run/control
Sun, 01 Sep 2013 03:14:50 GMT INFO -- Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.

@j2labs
Copy link
Owner

j2labs commented Sep 1, 2013

Looks like the user authentication is failing. That particular section of
the code is for creating a user.

Could you share the data you are using as input for validation? This means
the username, password, and email values used to create the user.

On Sun, Sep 1, 2013 at 1:08 AM, Patrick Lemiuex [email protected]:

HTH:

Sun, 01 Sep 2013 03:14:50 GMT ERRORhttp://src/unixy.c:55:%20errno:%20Operation%20not%20permittedCan't chroot to ./, rerun as root if this is what you want.
Sun, 01 Sep 2013 03:14:50 GMT WARNhttp://src/mongrel2.c:243:%20errno:%20NoneCouldn't chroot too ./, assuming running in test mode.
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/server.c:271 Starting 0MQ
with 1 threads.
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/request.c:57 MAX
limits.header_count=1280
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1029 MAX
limits.content_length=20480, limits.buffer_size=4096,
limits.connection_stack_size=32768, limits.client_read_retries=5
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1035 MAX
limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/task/fd.c:153 MAX
limits.fdtask_stack=102400
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:208 MAX
allowing limits.handler_targets=128
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:290 Binding
handler PUSH socket tcp://127.0.0.1:9999 with identity:
34f9ceee-cd52-4b7f-b197-88bf2f0ec378
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:316 Binding
listener SUB socket tcp://127.0.0.1:9998 subscribed to:
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/control.c:423 Setting up
control socket in at ipc://run/control
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/mongrel2.c:274 --
Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-23619043
.

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

Patrick
password
patricklemiuex AT gmail.com

What's weird, is why does the form redirect to / - shouldn't it not allow
the post?

On Sun, Sep 1, 2013 at 11:18 AM, James Dennis [email protected]:

Looks like the user authentication is failing. That particular section of
the code is for creating a user.

Could you share the data you are using as input for validation? This means
the username, password, and email values used to create the user.

On Sun, Sep 1, 2013 at 1:08 AM, Patrick Lemiuex [email protected]:

HTH:

Sun, 01 Sep 2013 03:14:50 GMT ERROR<
http://src/unixy.c:55:%20errno:%20Operation%20not%20permitted>Can't
chroot to ./, rerun as root if this is what you want.
Sun, 01 Sep 2013 03:14:50 GMT WARN<
http://src/mongrel2.c:243:%20errno:%20None>Couldn't chroot too ./,
assuming running in test mode.
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/server.c:271 Starting
0MQ
with 1 threads.
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/request.c:57 MAX
limits.header_count=1280
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1029 MAX
limits.content_length=20480, limits.buffer_size=4096,
limits.connection_stack_size=32768, limits.client_read_retries=5
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/connection.c:1035 MAX
limits.proxy_read_retries=100, limits.proxy_read_retry_warn=10
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/task/fd.c:153 MAX
limits.fdtask_stack=102400
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:208 MAX
allowing limits.handler_targets=128
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:290 Binding
handler PUSH socket tcp://127.0.0.1:9999 with identity:
34f9ceee-cd52-4b7f-b197-88bf2f0ec378
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/handler.c:316 Binding
listener SUB socket tcp://127.0.0.1:9998 subscribed to:
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/control.c:423 Setting
up
control socket in at ipc://run/control
Sun, 01 Sep 2013 03:14:50 GMT INFO http://src/mongrel2.c:274 --
Mongrel2/1.8.1 Running. Copyright (C) Zed A. Shaw. Licensed BSD.


Reply to this email directly or view it on GitHub<
https://github.com/j2labs/listsurf/issues/6#issuecomment-23619043>
.


Reply to this email directly or view it on GitHubhttps://github.com//issues/6#issuecomment-23626758
.

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

BTW, the db is empty.

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

from pymongo import MongoClient
db_conn = init_db_conn()
u = User.create_user('patrick','password','patricklemiuexAT !gmail.com')
u.validate()
True
save_user(self.db_conn, u)
Traceback (most recent call last):
File "", line 1, in
NameError: name 'self' is not defined
save_user(db_conn, u)
ObjectId('52239248b532f734801e433e')

What's weird is I think there's a unicode problem when I post to the handler... that's why validation is failing

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

The problem looks to be the version of bcrypt i am using, the password is coming in as unicode problem. I hate python unicoding!

File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/request_handling.py", line 325, in call
rendered = fun(*self._url_args)
File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 75, in wrapper
if not self.current_user:
File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 110, in current_user
self._current_user = self.get_current_user()
File "/Users/dj/listsurf/handlers.py", line 55, in get_current_user
if not user.check_password(password):
File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/models.py", line 58, in check_password
algorithm=algorithm, salt=salt)
File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/brubeck/auth.py", line 35, in gen_hexdigest
return (algorithm, salt, bcrypt.hashpw(raw_password, salt))
File "/Users/dj/.virtualenvs/listsurf/lib/python2.7/site-packages/bcrypt/init.py", line 91, in hashpw
raise TypeError("Unicode-objects must be encoded before hashing")
TypeError: Unicode-objects must be encoded before hashing
INFO:root:404 POST /login (127.0.0.1)

@reduxdj
Copy link
Author

reduxdj commented Sep 1, 2013

j2labs/brubeck#118 covers this

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

2 participants