Skip to content

Commit

Permalink
Fixed login redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan Vermeulen committed Nov 23, 2013
1 parent 8f375d7 commit 1af7ce9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions app/controllers/rich/cms_sessions_controller.rb
@@ -1,16 +1,14 @@
module Rich
class CmsSessionsController < ::ApplicationController
before_filter :allow_params_authentication!, :only => :login
layout false

def login
@success = Rich::Cms::Auth.login

if request.xhr?
respond_to do |format|
format.js
end
else
redirect_to "/"
respond_to do |format|
format.js
format.html { redirect_to "/" }
end
end

Expand Down
2 changes: 1 addition & 1 deletion app/views/rich/cms_sessions/login.js.erb
@@ -1,5 +1,5 @@
<% if @success %>
window.location.reload();
<% else %>
$("#<%= Rich::Cms::Auth.klass_symbol %>_<%= Rich::Cms::Auth.inputs.first %>").focus
$("#<%= Rich::Cms::Auth.klass_symbol %>_<%= Rich::Cms::Auth.inputs.first %>").trigger("focus");
<% end %>

0 comments on commit 1af7ce9

Please sign in to comment.