linked_rails-auth 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6bd380a29657097b4fab7a2cb3a4508c51598ee4d6b8effbee581cc01611b914
4
- data.tar.gz: b5958241cb5e600cf239687ac21d89a8d116a71bc8546b899e6a405718ac51e6
3
+ metadata.gz: bdac2ac7b1c19172bd134b16bb0a68b37d0e3554dbe2fa81758a8979ca978b16
4
+ data.tar.gz: f5a06a7413a6ea914343bb2e30c4777768772ecbde68550f3ac7185cdc346438
5
5
  SHA512:
6
- metadata.gz: bc2e1db01fa783039ef4b48064a63b37e934ba7b103180b02ef36e6c8d1e3bc58a8a7362e9d3fa1671a167cab168fdbc6bdcd4988400894e2bb952c7ef8e3f80
7
- data.tar.gz: 96139bd729c7ba737e4ccd4fb2539a00d1a0bfbd4dae6b8308e82d17aab249c3ddc12c72557be6a08c74cdb9f115ff83e2d1941b4af726c219bad5ea2fa7122e
6
+ metadata.gz: a74b845b028974e126b38cfc146869118d090337d9fde50558135294e9e9b377484e9a00f27855976fe0e1ebe42ce0e87992706f25f4199cbd1cabb30ae012ac
7
+ data.tar.gz: 99e7c1594200bcd42df838e537af3071f3664e855500041d781aeda362e7f7c77c620dbbb52bac74f8d4b329ed814994eeb160e37e685783913fca83f0f7f807
@@ -14,7 +14,9 @@ module LinkedRails
14
14
  include OtpHelper
15
15
 
16
16
  has_one_time_password
17
- belongs_to :owner, class_name: LinkedRails.otp_owner_class.to_s
17
+ # rubocop:disable Rails/ReflectionClassName
18
+ belongs_to :owner, class_name: LinkedRails.class_variable_get(:@@otp_owner_class)
19
+ # rubocop:enable Rails/ReflectionClassName
18
20
  validates :owner, presence: true
19
21
 
20
22
  attr_accessor :encoded_session, :otp_attempt
@@ -2,7 +2,9 @@
2
2
 
3
3
  module LinkedRails
4
4
  module Auth
5
+ # rubocop:disable Layout/LineLength
5
6
  class RegistrationPolicy < Pundit::PolicyFinder.new(LinkedRails.user_class).policy || LinkedRails.policy_parent_class
7
+ # rubocop:enable Layout/LineLength
6
8
  permit_attributes %i[email password password_confirmation redirect_url]
7
9
 
8
10
  def create?
@@ -2,7 +2,9 @@
2
2
 
3
3
  module LinkedRails
4
4
  module Auth
5
+ # rubocop:disable Layout/LineLength
5
6
  class RegistrationSerializer < RDF::Serializers.serializer_for(LinkedRails.user_class) || LinkedRails.serializer_parent_class
7
+ # rubocop:enable Layout/LineLength
6
8
  attribute :email, predicate: Vocab.schema.email, datatype: RDF::XSD[:string]
7
9
  attribute :password, predicate: Vocab.ontola[:password], datatype: RDF::XSD[:string]
8
10
  attribute :password_confirmation, predicate: Vocab.ontola[:passwordConfirmation], datatype: RDF::XSD[:string]
@@ -1,35 +1,35 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "rails/generators"
4
- require "rails/generators/active_record"
3
+ require 'rails/generators'
4
+ require 'rails/generators/active_record'
5
5
 
6
6
  module LinkedRails
7
7
  module Auth
8
- class InstallGenerator < ::Rails::Generators::Base
8
+ class InstallGenerator < ::Rails::Generators::Base # rubocop:disable Metrics/ClassLength
9
9
  include ::Rails::Generators::Migration
10
- source_root File.expand_path("templates", __dir__)
11
- desc "Installs LinkedRails Auth."
10
+ source_root File.expand_path('templates', __dir__)
11
+ desc 'Installs LinkedRails Auth.'
12
12
 
13
- def install
14
- template "doorkeeper_jwt_initializer.rb", "config/initializers/doorkeeper_jwt.rb"
15
- template "locales.yml", "config/locales/linked_rails_auth.en.yml"
16
- route "use_linked_rails_auth"
13
+ def install # rubocop:disable Metrics/MethodLength
14
+ template 'doorkeeper_jwt_initializer.rb', 'config/initializers/doorkeeper_jwt.rb'
15
+ template 'locales.yml', 'config/locales/linked_rails_auth.en.yml'
16
+ route 'use_linked_rails_auth'
17
17
 
18
18
  migration_template(
19
- "migration.rb.erb",
20
- "db/migrate/install_linked_rails_auth.rb",
19
+ 'migration.rb.erb',
20
+ 'db/migrate/install_linked_rails_auth.rb',
21
21
  migration_version: migration_version
22
22
  )
23
23
  update_user_model
24
24
  insert_doorkeeper
25
25
  create_doorkeeper_app
26
26
 
27
- readme "README"
27
+ readme 'README'
28
28
  end
29
29
 
30
30
  private
31
31
 
32
- def create_doorkeeper_app
32
+ def create_doorkeeper_app # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
33
33
  if Doorkeeper::Application.any?
34
34
  Rails.logger.info('Skipping Doorkeeper app creation, already exists')
35
35
 
@@ -67,7 +67,7 @@ module LinkedRails
67
67
  end
68
68
  end
69
69
 
70
- def insert_doorkeeper
70
+ def insert_doorkeeper # rubocop:disable Metrics/MethodLength
71
71
  file = 'config/initializers/doorkeeper.rb'
72
72
  data = "api_only\n"\
73
73
  "base_controller 'ApplicationController'\n"\
@@ -116,14 +116,14 @@ module LinkedRails
116
116
  request.env['warden'].logout
117
117
  user
118
118
  end
119
- FOO
119
+ FOO
120
120
  end
121
121
 
122
122
  def inject_controller_include
123
123
  sentinel = /LinkedRails::Controller\n/m
124
124
  in_root do
125
125
  inject_into_file(
126
- "app/controllers/application_controller.rb",
126
+ 'app/controllers/application_controller.rb',
127
127
  optimize_indentation('include LinkedRails::Auth::AuthHelper', 2),
128
128
  after: sentinel
129
129
  )
@@ -142,7 +142,12 @@ module LinkedRails
142
142
  def update_user_model
143
143
  file = 'app/models/user.rb'
144
144
  no_guest = "\ndef guest?\n false\nend"
145
- inject_into_file file, optimize_indentation(no_guest, 2), after: ":recoverable, :rememberable, :validatable\n", verbose: false
145
+ inject_into_file(
146
+ file,
147
+ optimize_indentation(no_guest, 2),
148
+ after: ":recoverable, :rememberable, :validatable\n",
149
+ verbose: false
150
+ )
146
151
  end
147
152
 
148
153
  class << self
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class CreateDoorkeeperApp < ActiveRecord::Migration<%= migration_version %>
3
+ class InstallLinkedRailsAuth < ActiveRecord::Migration<%= migration_version %>
4
4
  def up
5
5
  create_table :otp_secrets do |t|
6
6
  t.timestamps
@@ -2,6 +2,6 @@
2
2
 
3
3
  module LinkedRails
4
4
  module Auth
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linked_rails-auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Dingemans