Crash on Jumpstart when unconfirmed user tries to log in
safeMint•
Hi
Chris Oliver
Would love your help with this.
I need my users to confirm their email (because I plan on giving away free trials). So I have commented out the #skip_confirmation! in app/controllers/users/registrations_controller.rb line #9 and in app/models/user.rb line #65.
Once I do that, if a user who has signed up, but has not yet confirmed their email, they get a crash. (below)devise-crash-screen.jpg204 KB
To reproduce, you can just pull down Jumpstart, comment out those 2 lines, and then try to log in with an unconfirmed email.
I believe this has something to do with the devise / AJAX request / turbolinks. I've spent about 2 hours on it, but I'm not sure I'm going in the right direction.
Many posts from 2014 said you could just add `respond_to :json, :html` to application_controller.rb but that didn't work for me.
The best idea I had so far from the internet was to overload the sessions_controller so that it responded_to :html and :js
class Customized::SessionsController < Devise::SessionsController
# GET /resource/sign_in
def new
self.resource = resource_class.new(sign_in_params)
clean_up_passwords(resource)
yield resource if block_given?
respond_to do |format|
format.js
format.html
end
end
end