martin-denizet / redmine_login_audit

Redmine plugin to log successful login attempts in Redmine
44 stars 30 forks source link

Failed to save successful login #27

Closed GitRms closed 8 years ago

GitRms commented 8 years ago

I'm getting the following error in production.log:

LoginAudit: Failed to save login audit for User:'admin', id: 1, Login succeed: true, Error: undefined local variable or method `flash' for #<LoginAudit:0x007f61c97ae018

Failed logins are logged fine. How to fix? Thank you.

Redmine version: 3.2.1.stable Ruby version: 2.2.0 Rails version: 4.2.5.2

martin-denizet commented 8 years ago

Hello, thanks for reporting the issue. This issue is partially resolved in the "develop" branch. I should be able to release an update today. Cheers,

martin-denizet commented 8 years ago

Issue fixed in develop. You can test if you wish. I will release tomorrow.

GitRms commented 8 years ago

Hello, It logs all login attempts now but sends email for successfull logins only. The setting "Select what to audit" is set to "Failures and successes".

martin-denizet commented 8 years ago

Hello, I release the update. For email on failure, I didn't implement it yet. I promise to do it quickly!

martin-denizet commented 8 years ago

I added the possibility to get emails for login failures. It's in the 'develop' branch at the moment. Please give me your feedback if you test it. Cheers,

GitRms commented 8 years ago

Hello, It returns the following:

RAILS_ENV=production bundle exec rake redmine:plugins:migrate
/usr/local/rvm/gems/ruby-2.2.0/gems/htmlentities-4.3.1/lib/htmlentities/mappings/expanded.rb:465: warning: duplicated key at line 466 ignored: "inodot"
rake aborted!
NoMethodError: undefined method `empty?' for nil:NilClass
/home/XXXXX/public_html/3.2.1/plugins/redmine_login_audit/init.rb:42:in `block in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:446:in `instance_exec'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:446:in `block in make_lambda'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:192:in `call'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:192:in `block in simple'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:504:in `call'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:504:in `block in call'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:504:in `each'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:504:in `call'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:778:in `_run_prepare_callbacks'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
/usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.2.5.2/lib/action_dispatch/middleware/reloader.rb:83:in `prepare!'
/usr/local/rvm/gems/ruby-2.2.0/gems/actionpack-4.2.5.2/lib/action_dispatch/middleware/reloader.rb:55:in `prepare!'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/application/finisher.rb:50:in `block in <module:Finisher>'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/initializable.rb:30:in `instance_exec'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/initializable.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/initializable.rb:55:in `block in run_initializers'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/initializable.rb:54:in `run_initializers'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/application.rb:352:in `initialize!'
/home/XXXXX/public_html/3.2.1/config/environment.rb:14:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/dependencies.rb:274:in `require'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/dependencies.rb:274:in `block in require'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/dependencies.rb:240:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.0/gems/activesupport-4.2.5.2/lib/active_support/dependencies.rb:274:in `require'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/application.rb:328:in `require_environment!'
/usr/local/rvm/gems/ruby-2.2.0/gems/railties-4.2.5.2/lib/rails/application.rb:457:in `block in run_tasks_blocks'
/usr/local/rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => redmine:plugins:migrate => environment
(See full trace by running task with --trace)
martin-denizet commented 8 years ago

That's fixed. I updated the develop branch. Thank you for your testing!

GitRms commented 8 years ago

It's working now. I found one small bug in the subject of successful email: Subject: [web Login Failure] 'admin' - XXX.XXX.XXX.XXX

martin-denizet commented 8 years ago

Thank you very much for the testing! I changed the mail subject. Why is it a bug or what do you think the subject should be?

GitRms commented 8 years ago

I think the subject should be: [web Login Success] 'admin' - XXX.XXX.XXX.XXX on success and [web Login Failure] 'admin' - XXX.XXX.XXX.XXX on failure. Thank you.

martin-denizet commented 8 years ago

Thank you again for your testing. I fixed that and released version 0.3.0.