Project

General

Profile

Actions

Defect #8655

closed

After an ajax process, login info is missing.

Added by Tiffany C over 13 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
2011-06-21
Due date:
% Done:

0%

Estimated time:
Resolution:
Invalid
Affected version:

Description

Hi all,

After I upgraded from Redmine 1.1.0 to 1.2.0, one of my plugin functions using Ajax doesn't work. It seems like missing session info after calling Ajax and transits to the login screen after clicking some button. I don't know why it became AnonymousUser.

A little similar to #7843?

The log on the WEBRick is below.

  Setting Load (0.1ms)   SELECT * FROM `settings` WHERE (`settings`.`name` = 'login_required') LIMIT 1
Redirected to http://localhost:3000/login?back_url=http%3A%2F%2F10.23.1.48%3A3000%2Fprojects%2Fxyz%2Fwork_time%2Fshow

Filter chain halted as [:check_if_login_required] rendered_or_redirected.
Completed in 21ms (DB: 4) | 302 Found [http://localhost:3000/projects/xyz/work_time/show]
  SQL (0.1ms)   SET NAMES 'utf8'
  SQL (0.1ms)   SET SQL_AUTO_IS_NULL=0

Processing AccountController#login (for 10.18.9.7 at 2011-06-21 10:50:43) [GET]
  Parameters: {"back_url"=>"http://localhost:3000/projects/xyz/work_time/show", "action"=>"login", "controller"=>"account"}
  Setting Columns (1.6ms)   SHOW FIELDS FROM `settings`
  SQL (0.2ms)   SELECT max(`settings`.updated_on) AS max_updated_on FROM `settings` 
  Setting Load (0.1ms)   SELECT * FROM `settings` WHERE (`settings`.`name` = 'rest_api_enabled') LIMIT 1
  AnonymousUser Columns (1.7ms)   SHOW FIELDS FROM `users`
  AnonymousUser Load (0.1ms)   SELECT * FROM `users` WHERE ( (`users`.`type` = 'AnonymousUser' ) ) LIMIT 1
Rendering template within layouts/base
Rendering account/login

If I add the following code to my controller, it works fine, but I don't know if it is the right way to solve this problem.

skip_before_filter :verify_authenticity_token

My Ajax code is something like this.

  new Ajax.Request(ajax_url, 
                   {asynchronous:true, 
                    evalScripts:true, 
                    onComplete:function(request){
                        $('memo_area').value = request.responseText
                    }, 
                  }); 

Here is my environment:
  • rails (2.3.11, 2.3.5, 2.2.2)
  • rack (1.1.2, 1.0.1)

I would appreciate if anyone can tell me how to solve this problem.

Regards,

Actions

Also available in: Atom PDF