oauth-login/authorization/auth-route-methods.js
//This really depends on the aplication
This really depends on the aplication
This really depends on the aplication
function login(req, res){
    userExists(req.body.email, doTheyExist => {
        if(doTheyExist){
            dbHelper.getUser(req.body.username, req.body.password, (doMore, user) => {
                if(user instanceof Error) throw user
                req.login(user.email, (err)=>{
                    res.send({isAuthenticated : true})
                })
            })
        }else if(doTheyExist instanceof Error){
            sendResponse(res, -1, doTheyExist)
        }else{
            res.redirect('/')
        }
    })
}
function login ( req , res ) { userExists ( req . body . email , doTheyExist => { if ( doTheyExist ) { dbHelper . getUser ( req . body . username , req . body . password , ( doMore , user ) => { if ( user instanceof Error ) throw user req . login ( user . email , ( err ) => { res . send ( { isAuthenticated : true } ) } ) } ) } else if ( doTheyExist instanceof Error ) { sendResponse ( res , - 1 , doTheyExist ) } else { res . redirect ( '/' ) } } ) }
This really depends on the aplication
This really depends on the aplication
//sendResponse(res, "The user doesnt exist", null)