session access

298 views
Skip to first unread message

ins0mnia

unread,
Jul 16, 2012, 6:24:48 PM7/16/12
to der...@googlegroups.com
This might sound like a silly question as I'm a n00b here, any help would be appreciated.

What I'm trying to do is is the following:
1. Present a login form (user/pass)
2. Query against users table 
3. Upon success, store the "userID" or "isMember" in a session so I could later utilize auth like this:

--------------------------------
store.readPathAccess('users.*', function (pathFragment, accept) {   
var session = this.session;   
accept(session.isMember); 
});
---------------------------------

What I'm struggling with is the part where I need to setup session middleware, store and fetch userID / isMember. Uncommenting .use(store.sessionMiddleware...) in server/index.js for some reason breaks the code. I also need to have some sort of callback in case auth denied so I could redirect to /accessdenied for example.

Would very much appreciate if someone could provide a code snippet that illustrates how to read / write from/to a session... 

Thanks ;)

Nate Smith

unread,
Jul 16, 2012, 7:08:09 PM7/16/12
to der...@googlegroups.com
There was a silly bug in the project generator where I messed up copy-pasting in the JS version of the code. It is now fixed and republished.

You should run:
npm cache clear
npm install -g derby

Then regenerate the project. It was just punctuation typos.

We don't have an example of using auth just yet. One will be coming.

- Nate

ins0mnia

unread,
Jul 16, 2012, 7:20:10 PM7/16/12
to der...@googlegroups.com
Hi Nate,

Thanks for the quick reply, I just realized this was the case too when I looked at the chat example :)




On Tuesday, July 17, 2012 1:08:09 AM UTC+2, Nate Smith wrote:
There was a silly bug in the project generator where I messed up copy-pasting in the JS version of the code. It is now fixed and republished.

You should run:
npm cache clear
npm install -g derby

Then regenerate the project. It was just punctuation typos.

We don't have an example of using auth just yet. One will be coming.

- Nate

Krzysztof Baranowski

unread,
Aug 19, 2012, 10:50:29 PM8/19/12
to der...@googlegroups.com
Insomnia, 

Did you ever get this working, and if so could you send me your code for user login with sessions?

Also, unrelated: dude you seem to be pretty ahead of the curve on using derby, that is, you know how to use features that I've never seen any documentation on (mainly your autoSuggest project). Can you email me and tell me how you've managed that? I sit at the lotus feet of the master!

Chris

ins0mnia

unread,
Aug 21, 2012, 8:27:36 PM8/21/12
to der...@googlegroups.com
Hi Chris,

Apologies for the late reply been having hectic couple of days. Anyway, sessions don't quite work yet hopefully that'll come soon.

As for the autoSuggest component I basically learned the stuff by looking into the dropdown component that Nate made, I  did my best to document because component libs are not documented on the site yet. 

I'm planning to release more components soon which hopefully will help even more ;) I'll try to be "smarter" next time and maybe write a tutorial, it's just that I wrote so much comments inside the autoSuggest component it felt like a tutorial to me lol

Krzysztof Baranowski

unread,
Aug 24, 2012, 9:54:58 AM8/24/12
to der...@googlegroups.com
Affirmatory! Just curious if you had found some mystery resources I was unaware of.

Also here's hoping for sessions. Did the newest release change anything?

Nate Smith

unread,
Aug 24, 2012, 11:18:20 AM8/24/12
to der...@googlegroups.com

Sessions work in the chat example. The userId is simply assigned to each unique cookie, but auth code can also plug in to it. I'll put out a simple example using everyauth soon

Krzysztof Baranowski

unread,
Aug 28, 2012, 12:33:21 AM8/28/12
to der...@googlegroups.com
In my experience I can only  getModel().session when it hits the server (because of a page refresh or whatever) but not when I'm clicking between links on the client

BJ Jackson

unread,
Aug 11, 2013, 9:04:25 PM8/11/13
to der...@googlegroups.com
Is there a github repository for your autosuggest component?

TYIA

Vladimir Makhaev

unread,
Aug 14, 2013, 5:45:47 AM8/14/13
to der...@googlegroups.com

BJ Jackson

unread,
Aug 14, 2013, 12:12:27 PM8/14/13
to der...@googlegroups.com
Looks like the one, yes.
Reply all
Reply to author
Forward
0 new messages