使用羽毛认证,可以使用可配置的用户名字段对用户进行认证。目前,我可以将身份验证配置为使用用户模型的username
ORemail
字段,但我想同时向用户提供username
AND选项email
。
最好的方法是什么?
显然,可以连接身份验证方法,因此解决方案应类似于:
app.configure(auth({ secret: 'super secret' }))
.configure(local()) // defaults usernameField to 'email'
.configure(local({ // support username
name: 'local-username',
usernameField: 'username'
}));
可以在GitHub上找到更完整的示例:https : //github.com/jaredhanson/passport-local/pull/148#issuecomment-261506180
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句