diaspora/app/controllers/sessions_controller.rb
Sarah Mei fbf486dae6 Users can log in on their phones again.
Something in devise broke for the :mobile format. More investigation needed; we're having this same issue on log out and incorrect password on mobile (though those pages are at least still usable).
2011-05-14 14:58:52 -07:00

27 lines
867 B
Ruby

# Copyright (c) 2010, Diaspora Inc. This file is
# licensed under the Affero General Public License version 3 or later. See
# the COPYRIGHT file.
class SessionsController < Devise::SessionsController
after_filter :enqueue_update, :only => :create
def create
resource = warden.authenticate!(:scope => resource_name, :recall => "#{controller_path}#new")
set_flash_message(:notice, :signed_in) if is_navigational_format?
sign_in(resource_name, resource)
redirect_loc = redirect_location(resource_name, resource)
respond_with resource, :location => redirect_loc do |format|
format.mobile { redirect_to root_path }
end
end
protected
def enqueue_update
if current_user
current_user.services.each{|s|
Resque.enqueue(Job::UpdateServiceUsers, s.id) if s.respond_to? :save_friends
}
end
end
end