Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
source 'https://rubygems.org'

gem 'wice_grid', '3.5.0'
gem 'wice_grid', '~> 4.1'
gem 'protected_attributes_continued', '~> 1.4'
gem 'therubyracer'
4 changes: 2 additions & 2 deletions app/controllers/login_audit_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class LoginAuditController < AdminController
unloadable
layout 'admin'

before_filter :require_admin
before_action :require_admin

def index

Expand Down Expand Up @@ -49,4 +49,4 @@ def delete_all
redirect_to :action => 'index', :status => :found
end

end
end
6 changes: 3 additions & 3 deletions app/views/login_audit/_login_audit_grid.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
avatar(audit.user, :size => '16') unless audit.user.nil?
end

g.column name: t(:field_firstname), in_csv: false, attribute: 'firstname', model: 'User' do |audit|
g.column name: t(:field_firstname), in_csv: false, attribute: 'firstname', assoc: :user do |audit|
link_to(audit.user.firstname, user_path(audit.user), :class => audit.user.css_classes) unless audit.user.nil?
end

g.column name: t(:field_lastname), in_csv: false, attribute: 'lastname', model: 'User' do |audit|
g.column name: t(:field_lastname), in_csv: false, attribute: 'lastname', assoc: :user do |audit|
link_to(audit.user.lastname, user_path(audit.user), :class => audit.user.css_classes) unless audit.user.nil?
end

Expand All @@ -48,4 +48,4 @@
g.column name: t(:label_la_url), attribute: 'url'
g.column name: t(:label_la_method), attribute: 'method'

end -%>
end -%>
4 changes: 2 additions & 2 deletions db/migrate/001_create_login_audits.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Copyright (C) 2018 Martin Denizet <[email protected]>
#
class CreateLoginAudits < ActiveRecord::Migration
class CreateLoginAudits < ActiveRecord::Migration[5.2]
def change
create_table :login_audits do |t|
t.integer :user_id
Expand All @@ -13,4 +13,4 @@ def change
add_index :login_audits, :user_id
add_index :login_audits, :created_on
end
end
end
2 changes: 1 addition & 1 deletion db/migrate/002_add_ip_address_limit.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Copyright (C) 2018 Martin Denizet <[email protected]>
#
class AddIpAddressLimit < ActiveRecord::Migration
class AddIpAddressLimit < ActiveRecord::Migration[5.2]
def self.up
# 39 for IPv6, 15 for IPv4
change_column :login_audits, :ip_address, :string, :limit => 39
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/003_add_login_to_login_audit.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Copyright (C) 2018 Martin Denizet <[email protected]>
#
class AddLoginToLoginAudit < ActiveRecord::Migration
class AddLoginToLoginAudit < ActiveRecord::Migration[5.2]
def change
add_column :login_audits, :login, :string
add_column :login_audits, :api, :boolean, default: false
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/004_url_limit_increase.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#
# Copyright (C) 2018 Martin Denizet <[email protected]>
#
class UrlLimitIncrease < ActiveRecord::Migration
class UrlLimitIncrease < ActiveRecord::Migration[5.2]
def self.up
#Limit URLs to 255 characters, IE supports 2,083 characters URLs
change_column :login_audits, :url, :string, :limit => 255
Expand Down
9 changes: 6 additions & 3 deletions lib/redmine_login_audit/account_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@ def self.included(base) # :nodoc:
base.send(:include, InstanceMethods)

base.class_eval do
alias_method_chain :invalid_credentials, :login_audit
alias_method_chain :onthefly_creation_failed, :login_audit
alias_method :invalid_credentials_without_login_audit, :invalid_credentials
alias_method :invalid_credentials, :invalid_credentials_with_login_audit

alias_method :onthefly_creation_failed_without_login_audit, :onthefly_creation_failed
alias_method :onthefly_creation_failed, :onthefly_creation_failed_with_login_audit
end
end

Expand All @@ -31,4 +34,4 @@ def onthefly_creation_failed_with_login_audit
end
end

AccountController.send(:include, RedmineLoginAudit::AccountControllerPatch)
AccountController.send(:include, RedmineLoginAudit::AccountControllerPatch)
5 changes: 3 additions & 2 deletions lib/redmine_login_audit/application_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def self.included(base) # :nodoc:
base.class_eval do
unloadable

alias_method_chain :user_setup, :login_audit
alias_method :user_setup_without_login_audit, :user_setup
alias_method :user_setup, :user_setup_with_login_audit
end
end

Expand All @@ -32,4 +33,4 @@ def user_setup_with_login_audit
end
end

ApplicationController.send(:include, RedmineLoginAudit::ApplicationControllerPatch)
ApplicationController.send(:include, RedmineLoginAudit::ApplicationControllerPatch)