omn​​iauth自定义请求阶段表单

时间:2013-08-11 17:38:23

标签: ruby-on-rails devise omniauth

我正在尝试编写自定义的OmniAuth策略。这需要提示输入用户名和密码。 https://github.com/intridea/omniauth/wiki/Strategy-Contribution-Guide是一个有用的开始,我目前正在使用文档中提到的OmniAuth :: Form方法,但现在我想实现更好的登录表单。

该文件说OmniAuth has a very simple form builder built into it so that you can easily prompt the user for information that's needed for your strategy. These forms are really not meant to be shown to end users but rather work as a stopgap for developers until they implement custom forms...,但没有说明如何实施自定义表单。

我该怎么办?有一个很好的例子吗?

1 个答案:

答案 0 :(得分:2)

根据OmniAuth wiki,您只需在指定要使用的Rack中间件时提供:form选项:

use OmniAuth::Builder do
  provider :example, :form => SessionsController.action(:new)
end