开发者

How do I customize the before_filer :authenticate_user! from Devise?

I want to add url in emails that I'm sending to my users. I want to pass a parameter for their email like Facebook does so that the login email field will already be populated.

I figure if I pass this as a parameter in the url I should be able to handle it in开发者_如何学编程 the :authenticate_user! before_filter. If the user is not logged in then I can use that parameter to populate the field in the login form.

How do I go about doing this?


following the example of devise_invitable you can add a token to the url.

the controller that handles that url which can inherit from Devise::SessionsController and would find the user by the token and then show a costumized sign in form for the user

something like

# GET /users/sign_in
class MyAutoLoginController < Devise::SessionsController
  def new
    @user = User.find_by_token(params[:token]
    super
  end
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜