Compare commits
No commits in common. 'master' and 'get_specs_running' have entirely different histories.
master
...
get_specs_
23 changed files with 141 additions and 140 deletions
@ -0,0 +1,21 @@
|
||||
engines: |
||||
brakeman: |
||||
enabled: true |
||||
duplication: |
||||
enabled: true |
||||
config: |
||||
languages: |
||||
- ruby |
||||
# mass_threshold: 30 |
||||
exclude_paths: |
||||
- 'spec/**/*' |
||||
fixme: |
||||
enabled: true |
||||
rubocop: |
||||
enabled: true |
||||
|
||||
ratings: |
||||
paths: |
||||
- app/** |
||||
- lib/** |
||||
- '**.rb' |
@ -1,42 +0,0 @@
|
||||
name: 'CI/CD Pipeline' |
||||
|
||||
on: |
||||
push: |
||||
branches: |
||||
- master |
||||
pull_request: |
||||
workflow_dispatch: |
||||
|
||||
defaults: |
||||
run: |
||||
shell: bash |
||||
|
||||
jobs: |
||||
|
||||
test: |
||||
name: Test |
||||
runs-on: ubuntu-latest |
||||
|
||||
env: |
||||
RAILS_ENV: test |
||||
GEMFILE_RUBY_VERSION: 3.0.3 |
||||
|
||||
# Rails verifies the time zone in DB is the same as the time zone of the Rails app |
||||
TZ: "Europe/London" |
||||
|
||||
|
||||
steps: |
||||
- name: Checkout |
||||
uses: actions/checkout@v2 |
||||
|
||||
- name: Set up Ruby |
||||
uses: ruby/setup-ruby@v1 |
||||
with: |
||||
ruby-version: 3.0.3 |
||||
# runs 'bundle install' and caches installed gems automatically |
||||
bundler-cache: true |
||||
|
||||
- name: Run tests |
||||
run: | |
||||
bundle exec rake spec |
||||
|
@ -0,0 +1,28 @@
|
||||
language: ruby |
||||
|
||||
env: |
||||
- "RAILS_VERSION=4.2" |
||||
- "RAILS_VERSION=5.2" |
||||
- "RAILS_VERSION=master" |
||||
|
||||
rvm: |
||||
- 2.3.8 |
||||
- 2.4.5 |
||||
- 2.5.3 |
||||
|
||||
matrix: |
||||
fast_finish: true |
||||
allow_failures: |
||||
- env: "RAILS_VERSION=master" |
||||
include: |
||||
- rvm: 2.2 |
||||
env: RAILS_VERSION=4.2 |
||||
|
||||
before_install: |
||||
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true |
||||
- gem install bundler -v '< 2' |
||||
|
||||
before_script: |
||||
- bundle exec rake app:db:setup |
||||
|
||||
script: bundle exec rake spec |
@ -1,14 +0,0 @@
|
||||
require "active_record" |
||||
|
||||
module Devise2Fa |
||||
module Orm |
||||
module ActiveRecord |
||||
module Schema |
||||
# include Devise2Fa::Schema |
||||
end |
||||
end |
||||
end |
||||
end |
||||
|
||||
ActiveRecord::ConnectionAdapters::Table.send :include, Devise2Fa::Orm::ActiveRecord::Schema |
||||
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, Devise2Fa::Orm::ActiveRecord::Schema |
@ -1,7 +0,0 @@
|
||||
module DeviseTwoFactorAuthentication |
||||
class Engine < ::Rails::Engine |
||||
ActiveSupport.on_load(:action_controller) do |
||||
include DeviseTwoFactorAuthentication::Controllers::Helpers |
||||
end |
||||
end |
||||
end |
@ -1,3 +0,0 @@
|
||||
module DeviseTwoFactorAuthentication |
||||
VERSION = "3.0.0".freeze |
||||
end |
@ -1,17 +1,17 @@
|
||||
Warden::Manager.after_authentication do |user, auth, options| |
||||
if auth.env["action_dispatch.cookies"] |
||||
expected_cookie_value = "#{user.class}-#{user.public_send(Devise.second_factor_resource_id)}" |
||||
actual_cookie_value = auth.env["action_dispatch.cookies"].signed[DeviseTwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME] |
||||
actual_cookie_value = auth.env["action_dispatch.cookies"].signed[TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME] |
||||
bypass_by_cookie = actual_cookie_value == expected_cookie_value |
||||
end |
||||
|
||||
if user.respond_to?(:need_two_factor_authentication?) && !bypass_by_cookie |
||||
if auth.session(options[:scope])[DeviseTwoFactorAuthentication::NEED_AUTHENTICATION] = user.need_two_factor_authentication?(auth.request) |
||||
if auth.session(options[:scope])[TwoFactorAuthentication::NEED_AUTHENTICATION] = user.need_two_factor_authentication?(auth.request) |
||||
user.send_new_otp if user.send_new_otp_after_login? |
||||
end |
||||
end |
||||
end |
||||
|
||||
Warden::Manager.before_logout do |user, auth, _options| |
||||
auth.cookies.delete DeviseTwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME if Devise.delete_cookie_on_logout |
||||
auth.cookies.delete TwoFactorAuthentication::REMEMBER_TFA_COOKIE_NAME if Devise.delete_cookie_on_logout |
||||
end |
@ -0,0 +1,14 @@
|
||||
require "active_record" |
||||
|
||||
module TwoFactorAuthentication |
||||
module Orm |
||||
module ActiveRecord |
||||
module Schema |
||||
include TwoFactorAuthentication::Schema |
||||
end |
||||
end |
||||
end |
||||
end |
||||
|
||||
ActiveRecord::ConnectionAdapters::Table.send :include, TwoFactorAuthentication::Orm::ActiveRecord::Schema |
||||
ActiveRecord::ConnectionAdapters::TableDefinition.send :include, TwoFactorAuthentication::Orm::ActiveRecord::Schema |
@ -0,0 +1,7 @@
|
||||
module TwoFactorAuthentication |
||||
class Engine < ::Rails::Engine |
||||
ActiveSupport.on_load(:action_controller) do |
||||
include TwoFactorAuthentication::Controllers::Helpers |
||||
end |
||||
end |
||||
end |
@ -1,4 +1,4 @@
|
||||
module DeviseTwoFactorAuthentication |
||||
module TwoFactorAuthentication |
||||
module Schema |
||||
def second_factor_attempts_count |
||||
apply_devise_schema :second_factor_attempts_count, Integer, :default => 0 |
@ -0,0 +1,3 @@
|
||||
module TwoFactorAuthentication |
||||
VERSION = "2.2.0".freeze |
||||
end |
Loading…
Reference in new issue