egg icon indicating copy to clipboard operation
egg copied to clipboard

求助:如何使用账号/密码配合egg-passport-local登录?

Open mrchenguozheng opened this issue 7 years ago • 9 comments

项目是使用 egg-init . --type=simple 建立的,没有 app.js 这个文件。 按照eggjs官网的说明安装和启用了 egg-passport 和 egg-passport-local 插件。 看过 https://github.com/eggjs/egg-passport-local 的README,可惜没有理解账号/密码验证这一步应该插到什么位置。 希望能有一个简单的示例。

mrchenguozheng avatar Dec 12 '18 02:12 mrchenguozheng

  • https://github.com/eggjs/examples/blob/master/passport/README.md
  • https://github.com/eggjs/egg-passport-local/blob/master/test/fixtures/apps/passport-local-test/app.js

账号的其实可以不用这个插件,直接自己写个 Controller 就完了,没必要绕一圈

atian25 avatar Dec 12 '18 05:12 atian25

* https://github.com/eggjs/examples/blob/master/passport/README.md

* https://github.com/eggjs/egg-passport-local/blob/master/test/fixtures/apps/passport-local-test/app.js

账号的其实可以不用这个插件,直接自己写个 Controller 就完了,没必要绕一圈

感谢解答! 登录这个,试着在写了。

不过,上面两个链接看过依然雾水。这个插件egg-passport-local,是用来做什么的?

mrchenguozheng avatar Dec 12 '18 09:12 mrchenguozheng

  1. egg-passport-local 是按照Passport.js 规范实现的一个插件
  2. 使用中,@atian25 已经讲过了,可以不走这一套,添加一个controller直接处理POST过来的表单数据就可以了;当然了,你可以遵循标准,示例里不明白的地方具体指什么?

thonatos avatar Dec 17 '18 02:12 thonatos

1. `egg-passport-local` 是按照`Passport.js` 规范实现的一个插件

2. 使用中,@atian25 已经讲过了,可以不走这一套,添加一个`controller`直接处理`POST`过来的表单数据就可以了;当然了,你可以遵循标准,示例里不明白的地方具体指什么?

感谢您的解答!

因为没有使用过Passport.js,加之egg-passport的例子中没有看到 egg-passport-local的部分。 既然目前用不上……暂且关闭这个了。

mrchenguozheng avatar Dec 18 '18 09:12 mrchenguozheng

passport这个教程写的。。。 没看懂

hongz1125 avatar Mar 08 '19 03:03 hongz1125

的确看不懂

hengkx avatar Feb 28 '20 14:02 hengkx

文档和demo真垃圾

jiengsad avatar Aug 13 '20 02:08 jiengsad

因为看不懂文档过来的 +1

kurilee avatar Sep 12 '21 09:09 kurilee

难绷,2025回来考古,文档确实不行

faithleysath avatar Jun 30 '25 01:06 faithleysath