Skip to content

Is there a way to pass the route? #223

@nofear87

Description

@nofear87

Is it possible to pass the route to the login function? For example to check that only a user with special role like admin can access a spcial page?

My Ideas is to check this at this point:

function isLoggedIn(req, res, next) {

    // if user is authenticated 
        //and when route/page = admin user must have role admin
    if (req.isAuthenticated()) {

        return next();

    }

    // if they aren't redirect them to the home page
    res.redirect('/');

}

Or is there another way? Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions