WEB6 - Multi User Auth

로그인 구현

수업소개

로그인 기능을 구현하는 방법에 대해서 알아봅니다. 

 

 

 

강의

 

 

 

소스코드

변경사항

 

댓글

댓글 본문
작성자
비밀번호
  1. http://www.yeezy-500.us.com
    http://www.redbottom-shoes.us.com
    http://www.cheap-airjordans.us.com
    http://www.filashoes.us.org
    http://www.nike-hyperdunk.us.com
    http://www.yeezyboost350v2.org.uk
    http://www.curry4.net
    http://www.yeezysshoes.us.com
    http://www.toryburchs.us
    http://www.chromeheartsoutletonline.com
    http://www.jordan11retro.us.com
    http://www.filashoes.org
    http://www.adidasstansmith.uk
    http://www.offwhitexjordan1.com
    http://www.air-max.us.com
    http://www.yeezy-boost.us.com
    http://www.yesyeezy.shop......tml
    http://www.jimmychoo-shoes.us.com
    http://www.nikeairmax2019.us.com
    http://www.hermes-handbags.us.com
    http://www.nikepolo.us
    http://www.outletlacoste.us.com
    http://www.fila-shoes.us.com
    http://www.goldengoosesneakers.us
    http://www.jordan13.us.com
    http://www.nikereact.org
    http://www.bapehoodie.us
    http://www.ferragamobelt.us
    http://www.adidasnmduk.com
    http://www.monclerjackets.us
    http://www.kyrieirving-shoes.us.com
    http://www.lacostepolo.us.com
    http://www.yesyeezy.shop......tml
    http://www.yeezy-shoes.us.org
    http://www.adidasyeezy.co.uk
    http://www.coachoutletstorefactory.com
    http://www.jordan4.us.com
    http://www.yeezy-boost350.us.com
    http://www.goyard.us.com
    http://www.hogan-outlet.us.com
    http://www.jordansshoes.us.org
    http://www.yslhandbags.net
    http://www.fitflops-saleclearance.us.com
    http://www.katespadehandbags-outlet.us.com
    http://www.yeezyboost350v2shoes.us.com
    http://www.adidas-tubular.us.com
    http://www.asics-shoes.us.org
    http://www.hermesbelts.com
    http://www.yesyeezy.shop......tml
    http://www.yeezyshoesuk.com
    http://www.nike-roshe.us.com
    http://www.nikejordans.us.com
    http://www.outletmichael-kors.us.com
    http://www.supremeclothing.us
    http://www.goyardbags.us
    http://www.adidas-crazyexplosive.us.com
    http://www.michael-kors-handbags.com.co
    http://www.adidasiniki.us
    http://www.yeezysshoes.org
    http://www.guccibelt.us.com
    http://www.kd11.us.com
    http://www.yesyeezy.shop
    http://www.hermesonlineshop.com
    http://www.longchamphandbags.co.uk
    http://www.lebron16.us
    http://www.hermes-birkin.us.com
    http://www.goldengoose.us.com
    http://www.yesyeezy.shop/supreme-x-nike-air-more-uptempo-varsity-redwhite-902290600-p-592.html
    http://www.kobesneakers.com
    http://www.coachoutletssale.com
    http://www.kd11.us
    http://www.nikeair-max.us.com
    http://www.hermeshandbags.us.org
    http://www.caterpillarboots.us.com
    http://www.airmax90.us.org
    http://www.coachoutlets.name
    http://www.offwhite.us.com
    http://www.yeezyboost-350v2.us.com
    http://www.adidassuperstar.us.com
    http://www.coachsonline.us.com
    http://www.yesyeezy.shop/adidas-yeezy-boost-350-v2-cream-white-cp9366-p-423.html
    http://www.jordan12.us.com
    http://www.golden-goose.us.com
    http://www.calvinkleinoutlet.us.com
    http://www.lebron16.us.com
    http://www.converseoutlet.us.com
    http://www.yesyeezy.shop/adidas-yeezy-boost-350-v2-beluga-solar-red-bb1826-p-422.html
    http://www.hardenshoes.us.com
    http://www.kobebasketballshoes.net
    http://www.goyardhandbags.org
    http://www.yeezy-boosts.us.com
    http://www.lebronjames-shoes.us.com
    http://www.nikebasketballshoes.us.com
    http://www.nike-shox.us.com
    http://www.balenciagashoes.us.com
    http://www.lebron15.net
    http://www.louboutinshoes.uk
    http://www.jordanshoes.org.uk
    http://www.yesyeezy.shop/balenciaga-17fw-triple-s-trainer-black-red-mens-w05m23972-p-613.html
    http://www.jordanssneakers.us.com
    http://www.balenciaga.us.com
    http://www.nikesneakers.us.com
    http://www.adidas-pureboost.us.com
    http://www.nike-airmax2017.us.com
    http://www.fakerolex.us.com
    http://www.nikeflyknit.us.com
    http://www.outletonline-michaelkors.us.org
    http://www.paulgeorgeshoes.us.com
    http://www.ultraboost.us.com
    http://www.adidasstansmith.us.com
    http://www.jordan-retro.us.com
    http://www.shoesjordan.us.com
    http://www.reebokoutlet.us.org
    http://www.russellwestbrookshoes.us.com
    http://www.yeezyboost-350.uk
    http://www.pandorabracelet.in.net
    http://www.airjordanretro.uk
    http://www.adidasyeezys.us.com
    http://www.outlettimberland.us.org
    http://www.kyrie4.org
    http://www.yesyeezy.shop/offwhite-air-jordan-1-retro-chicago-the-ten-aa3834101-p-837.html
    http://www.yesyeezy.shop/air-jordan-1-og-game-royal-blue-mens-555088403-p-682.html
    http://www.goldengooseoutlet.us
    http://www.valentinosshoes.us
    http://www.kyrie3.us.com
    http://www.nhljerseysshop.us.com
    http://www.nfljerseys.us.org
    http://www.coachoutletsfactory.com
    http://www.long-champ.us.com
    http://www.supremehoodie.us.com
    http://www.michael-kors-handbags.org.uk
    http://www.hermes-belt.us.com
    http://www.yeezy700.us.com
    http://www.nikefoamposite.us.com
    http://www.lebron16.net
    http://www.yesyeezy.shop/offwhite-x-nike-air-presto-black-aa3830002-p-291.html
    http://www.lacostepolosshirts.com
    http://www.yesyeezy.shop/adidas-yeezy-desert-rat-500-blush-db2908-p-425.html
    http://www.yeezysuk.com
    http://www.mbtshoesonline.com
    http://www.handbagsmichaelkors.com
    http://www.goyardhandbags.us.com
    http://www.adidasoutletonline.com
    http://www.chromehearts.com.co
    http://www.fila.us.org
    http://www.kevindurant-shoes.us.com
    http://www.vapormaxshoes.us
    http://www.michael--korsoutlet.us.org
    http://www.michaelkors-outletfactory.us.org
    http://www.chromehearts.name
    http://www.yesyeezy.shop/balenciaga-17fw-triple-s-black-pink-women-sneaker-483523w06e38080-p-618.html
    http://www.yeezyboost.in.net
    http://www.offwhiteclothing.us.com
    http://www.birkinbag.us.com
    http://www.hermesbelts.co.uk
    http://www.balenciagashoes.us.org
    http://www.bape-hoodie.us.com
    http://www.mlbjerseys.in.net
    http://www.vans-outlet.us.com
    http://www.jordan6.us.com
    http://www.michaeljordanshoes.us.com
    http://www.curry5.us.com
    http://www.polosralphlaurenuk.com
    http://www.curry4shoes.us.com
    http://www.adidasgazelle.us.com
    http://www.lacosteonlineshop.us.com
    http://www.goyard-handbags.us.com
    http://www.retro-jordans.us.com
    http://www.michael-korsoutlets.us
    http://www.goldengoose-outlet.us.com
    http://www.offwhitehoodie.us.com
    http://www.goldengoose-sneakers.com
    http://www.off-whiteshoes.us.com
    http://www.adidasyeezys.us
    http://www.kobe-shoes.us.com
    http://www.monclersoutlet.us.com
    http://www.ferragamobelt.us.org
    http://www.michaelkors-outletonlines.us.com
    http://www.nikecortez.us.com
    http://www.yeezy500.us
    http://www.adidasultraboost.us.org
    http://www.jordansforcheap.us.com
    http://www.canada-goose.in.net
    http://www.nikeairmax2018.us.com
    http://www.goldengoose-sneakers.us
    http://www.nikereact.us.com
    http://www.adidasnmds.us.com
    http://www.nikehuaracheshoes.us.com
    http://www.airmax270.us.com
    http://www.cheapnbajerseyswholesales.us.com
    http://www.nike-huarache.com
    http://www.adidasnmds.com
    http://www.yeezyboost.com.co
    http://www.nikeairforce1.us.com
    http://www.adidaseqts.com
    http://www.yeezy-shoes.org.uk
    http://www.yesyeezy.shop/nike-air-max-197-sean-wotherspoon-aj4219400-p-66.html
    http://www.adidasshoesonline.com
    http://www.kd-10.us
    http://www.longchampshandbags.us
    http://www.adidaszxflux.com
    http://www.monclerjacket.net
    http://www.rolex-replica.us.com
    wwwe
  2. jo_onc
    저는 ignore 기능을 이용해도 문제가 해결되지 않아서 알려주신 방법을 적용해보니 아주 잘 작동하네요.
    감사합니다!
    대화보기
    • 삼고잉
      잘 읽었습니다
    • 포로리야
      더 좋은 방법을 찾았네요

      pm2 같은 프로세서 관리 프로그램 중에 파일이 수정되면 자동으로 restart하는 기능이 문제였습니다. (pm2는 --watch)

      session.save의 매커니즘이 어떻게 되는지는 모르겠지만

      미들웨어가 sessions 파일을 건드리면 pm2가 파일이 변경된것으로 인식해 재시작 되면서

      session에 serialize가 안되는 문제가 생깁니다.

      pm2 에 --watch를 넣지 않고 수동으로 재시작 해주던가

      pm2 --watch --igonore-watch="sessions/* db.json"

      이렇게 ignore 옵션을 넣어주면 해당 디렉토리의 모든 파일이나 지정된 파일이 수정되어도 무시합니다.
      대화보기
      • 포로리야
        옵션을 객체로 간편하게 넘겨서 사용하는 passport.authenticate 메소드는 메모리에 있는 session 정보가 redirect 되기 전에 파일로 기록되지 않는 것 같습니다.

        아마 비동기식으로 response의 redirect처리가 먼저되어 페이지가 로딩되고 그후에 session 정보가 파일로 저장 되는 것 같네요.

        저는 passport.authenticate에 redirect 되기 전에 파일로 기록하는 custom callback을 만들어서 사용하였습니다.

        router.post('/login_process', function (req, res, next) {
        passport.authenticate('local', function (err, user, info) {
        if (err) {
        return next(err);
        }
        if (!user) {
        req.flash('error', info.message);
        return req.session.save(function (err) {
        if (err) {
        return next(err);
        }
        return res.redirect('/auth/login');
        })
        }
        req.login(user, function (err) {
        if (err) {
        return next(err);
        }
        req.flash('success', info.message);
        return req.session.save(function (err) {
        if (err) {
        return next(err);
        }
        return res.redirect('/');
        });
        });
        })(req, res, next);
        });
      graphittie 자세히 보기