totaljs/framework4

`AUTH` delegate does not throw 404 errors

Closed this issue · 4 comments

fgnm commented

Hi, as title I've noticed that when using AUTH delegate framework doesn't throw 404 errors anymore, I don't know am I missing something here?

This is my auth.js file, but the issue can be noticed in example too.

MAIN.session = SESSION();

// Delegate for loading session data
MAIN.session.ondata = function(meta, next) {
    FUNC.rdbms.get('SELECT * FROM user WHERE id = :id', { id: meta.id })
    .then(result => {
        next(null, result);
    }).catch(err => {
        next(err, null);
    });
};

AUTH(function($) {
	// Session options:
	var opt = {};
	opt.name = CONF.cookie;
	opt.key = CONF.cookie_secret;
	opt.expire = '3 days';

	// opt.options = {};           // Optional, a cookie options when the the cookie is extended (default: { httponly: true, security: 'lax' })
    opt.ddos = 5;

	MAIN.session.getcookie($, opt, $.done());
});

Whenever I try to open a page that shouldn't exists, framework return 401 error page. I'm using total4 0.0.44.
Thanks

Hi @fgnm,
It throws 401 and you can catch it via ROUTE('#401', ...)

Whenever I try to open a page that shouldn't exists, framework return 401 error page. I'm using total4 0.0.44.

I'm going to check it.

Yes, there is a bug. I'll solve it.
Thank you!

Fixed, please try it $ npm install total4@beta.

fgnm commented

@petersirka thanks now it works!