I have an Authlogic c login form :remote => truethat does a little inline validation using an RJS template if the user / password is invalid. This works fine, but when the credentials are valid, they are not redirected properly elsewhere.
Here is the controller that responds to form input:
class UserSessionsController < ApplicationController
respond_to :html, :js
before_filter :require_no_user, :only => [:new, :create]
before_filter :require_user, :only => :destroy
def new
@user_session = UserSession.new
end
def create
@user_session = UserSession.new(params[:user_session])
respond_to do |format|
if @user_session.save
flash[:notice] = "Login successful!"
format.html { redirect_to account_url }
else
format.js
end
end
end
def destroy
current_user_session.destroy
flash[:notice] = "Logout successful!"
redirect_to root_path
end
end
The part works format.js, but if the user / password is good ( format.html), nothing happens. However, if I look at the development.log file, it requests the account_url page. It just does not redirect you to the browser. I think it returns the account page via AJAX, and I just want a normal redirect.
HTML for the form:
<%= simple_form_for(
:user_session, @user_session,
:url => { :controller => 'user_sessions', :action => "create" },
:html => { :id => 'login-dropdown' }, :remote => true) do |f| %>