I want to override authenticate_user and current_user method of devise gem

前端 未结 5 504
醉梦人生
醉梦人生 2020-12-16 15:22

I want to override authenticate_user! and current_user method of devise gem in my application Controller can you please help me with regards to that Thanks

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 15:42

    On overriding how a user is authenticated:

    Devise uses Warden under the hood https://github.com/plataformatec/devise/blob/master/lib/devise/controllers/helpers.rb

    So you can just add a new strategy in Warden to authenticate your users. See https://github.com/hassox/warden/wiki/Strategies

    You should not need to override current_user. What challenge are you facing ? Do you need a different model returned ?

提交回复
热议问题