lib/authpwn_rails/session.rb in authpwn_rails-0.7.4 vs lib/authpwn_rails/session.rb in authpwn_rails-0.7.5

- old
+ new

@@ -82,11 +82,11 @@ end end end end -# Included in controllers that call authenticates_using_session. +# Included in controllers that call authpwn_session_controller. module SessionControllerInstanceMethods # GET /session/new def new @user = User.new @redirect_url = flash[:auth_redirect_url] @@ -108,11 +108,13 @@ home unless performed? respond_to do |format| format.html { render :action => :home } format.json do - render :json => { :user => @user.serializable_hash, + user_data = @user.as_json + user_data = user_data['user'] if @user.class.include_root_in_json + render :json => { :user => user_data, :csrf => form_authenticity_token } end end end end @@ -127,10 +129,12 @@ respond_to do |format| if current_user format.html { redirect_to @redirect_url } format.json do - render :json => { :user => current_user.serializable_hash, + user_data = @user.as_json + user_data = user_data['user'] if @user.class.include_root_in_json + render :json => { :user => user_data, :csrf => form_authenticity_token } end else notice = 'Invalid e-mail or password' format.html do