last day (14 days later) » 

15:15
miaou maybe?
doesn't matter. just dont' want more than one person testing
otherwise you'll never see the issue
I setup a heroku app to showcase the problem
ugh.. and now the dyno wont restart
fml
and it's up :P
hehe
ping me when you get back.
15:18
yeah, gimme 5 mins
just gonna smoke
no problem
kk let me just make sure it is still "working"
nope
god this is so strange. :?
ok well here it is
simple-auth-demo.herokuapp.com "demo" "demo" for username/pass
login and log out quickly. everything works.
you can even do it multiple times.
log in and wait 90 seconds, log out and try to log in again.
no data received
15:26
hm
I'm getting the no data received
also happens if you log in, log out, wait 90 secs, try to log in again
on the 2nd try
really?
oh nope
just application error
lol
15:27
yeah, application error
yea I see that. strange.
ohh yea
I didn't put that view file in there. oops.
this is 'hacked' out of another project to make a 'simple' demo
np
tell me when it's up again
here is the auth code, I'm going to just quickly upload the error view
when the second login attempt happens, you can see I've added console.logs describing what is hit
could it still be a connection not closing issue ???
module.exports = function(fn) {
	var closeConnection;
	return pg.connectAsync(process.env.DATABASE_URL).spread(function(client, close) {
		closeConnection = close;
		return fn(client);
	}).finally(function() {
		closeConnection();
	});
};
because the log stops after the client.queryAsync without throwing errors
nope, that should work
passport suggests this:
router.post('/logout', function(req, res) {
	req.logout();
	res.redirect('/');
});
for logging out
SO suggests this:
router.post('/logout', function(req, res) {
    req.session.destroy(function() {
        return res.redirect('/');
    });
});
dunno what req.logout() is
I've tried both.
15:33
what's your express version?
@FlorianMargaine passport voodoo
express 4
anyway set up your thing correctly
I need to test the logout
clearly, it's not working
I have a sessid
look at the http headers
ok try now.
damn heroku is giving me the run around. need to restart the dyno like 3 times
there's no set-cookie in the logout
let me see how miaou does it
(it uses passport too)
req.session.destroy(function() {
    return res.redirect('/');
});
is how I did it with express 3
:?
15:36
uh, there isn't a set-cookie either with miaou...
just thinking aloud, and it wouldn't make sense that it would, but could get/post be making a difference here?
what's your login route?
I wouldn't think so... but damn, express/passport do so much 'magic' behind the scenes
yeah, it's possible
router.post('/login', function(req, res, next) {
    passport.authenticate('local', function(err, user, info) {
        if (err) {
            return next(err);
        }
        if (!user) {
            return res.redirect('/?loginFailed');
        }
        req.login(user, function(err) {
            if (err) {
                return next(err);
            }
            if (user.role === 'admin') {
                return res.redirect('/admins');
            }
            return res.redirect('/users');
at times like this I miss my simple php auth :P
15:39
yeah looks fine
try changing the post for logout to a get...
although I'm not sure it's the issue...
I'm 99% sure it isn't.
I'm grasping at straws here
yeah well if passport had the awesome idea of using http, it'd be great y'know
i.e. using set-cookie header to remove the session cookie
lol looks like req.logout(); doesn't do shit
18
A: Why is PassportJS in Node not removing session on logout

BriceRan into the same issue. Using req.session.destroy(); instead of req.logout(); works, but I don't know if this is the best practice.

and the answer below too
10 mins ago, by rlemon
I've tried both.
15:43
can you put on the destroy version up?
putting the get version with destroy right now
'demo' 'demo' uses get
'admin' 'admin' uses post
you want the complete source?
or I can add your as a colab on heroku
yeah
it's broken with admin/admin
with demo/demo too
there is the source code
dependancies are all fucked up, protip: don't re-use directories when starting a new project :P
and for complete-ness
CREATE TABLE subscribers (
    username character varying(20) NOT NULL,
    ip character varying(15),
    password character varying(80),
    role character(5) DEFAULT 'user'::bpchar NOT NULL,
    email character varying,
    company_name character varying,
    phone character varying,
    can_email boolean,
    can_sms boolean,
    email_limit integer,
    sms_limit integer,
    contact_name character varying,
    port character(6)
);
table schema export
15:51
js is so ugly
sorry :P
why character(6) for the port?
anyway
because it is a 6 char value always
it's still broken
@rlemon it's not an IP port?
15:53
my bad then
@rlemon can you check the app's logs?
yes but nothing that stands out to me as far as getting a solution
I mean, you can't login anymore right?
lol one sec
that .get is annoying
sorry, I'm on windows atm.
console size is limited.
that is log in, log out, log in -> fail
16:01
for me
it's login -> fail
hrm
you can see what I'm trying to setup right?
a simple auth system with roles?
this shouldn't be such a PITA
yeah
I hate node tbh
lol
PHP & Lisp 4Lyfe?
well, not hate
but I don't want to use it for anything lately
PHP is for work only...
I wanna move over to io.js soon. but right now I wanna get the code working :P hehe
16:03
node or io is the same
did you see that io.js wanna split in another fork?
well, yes and no
it's getting funny
they want two io.js forks?
the fuck?
yeah, ask Benji
:sigh:
time to learn python I guess
16:07
lul
sorry about that, can't help you there...
if I can't even login... ._.
@rlemon wrt the io.js fork...
in JavaScript, 33 secs ago, by ssube
@FlorianMargaine wasn't that just a friday song joke?
my bad.
YOUR FUCKING GOD!
I SWEAR TO ALLAH IS THIS IS MY PROBLEM
so far it looks like it was :(
maybe not
s/client.queryAsync/return client.queryAsync/
still timing out tho
16:26
the amount of times I mistype heroky makes me think I should alias it
think I solved it \o/
just waiting now
what's the issue?
wrapping passport.use with getDb caused getDB to never close
I logged in the finally. it never hit
.... no magic at all
man. that was half the day friday as well
fuck I'm glad I got that sorted
thanks for the help!
... very much help
16:33
you started helping, I solved the issue. who knows if I would have looked in the right place without you
take the credit :P
> I don't want to be associated with that code ~ Florian
lul :D
no it's more like
> I don't want to be associated with success I didn't contribute to ~ me
simple-auth-demo.herokuapp.com/login log in and out like a mother fucking boss!
:D
16:36
now I can rename those view titles from "bs" to "not bs anymore!"
in your fucking face boss

last day (14 days later) »