I'm using Rails 4 with Devise and I've got a situation where I need to log someone in where the password is made up of 2 separate input fields. After submitting, I need to combine the 2 inputs to form the password before the params get used to authenticate them.
I know the login details are correct because if I have a single password field it all works as expected.
As a test I've tried to submit a blank password and then intercept the params in the sessions controller by temporarily hard coding the correct password - e.g.
class SessionsController < Devise::SessionsController
def create
params[:user][:password] = "ABCDE-12345"
[... the rest of the standard devise sessions controller ... ]
end
end
But that simply doesn't work. Something is happening before hitting this controller and any pointers on how I can intercept the submitted parameters would be appreciated. Code for the Devise controller is here:
https://github.com/plataformatec/devise/blob/master/app/controllers/devise/sessions_controller.rb
Do I need to write a custom Warden strategy perhaps?