orthodox 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +3 -7
- data/dummy/.ruby-version +1 -1
- data/dummy/Gemfile +2 -2
- data/dummy/Gemfile.lock +111 -113
- data/lib/generators/authentication/templates/controllers/concerns/authentication.rb.erb +24 -24
- data/lib/generators/authentication/templates/controllers/sessions_controller.rb.erb +4 -4
- data/lib/generators/authentication/templates/controllers/tfa_sessions_controller.rb.erb +2 -2
- data/lib/generators/authentication/templates/controllers/tfas_controller.rb.erb +2 -2
- data/lib/generators/authentication/templates/helpers/otp_credentials_helper.rb +2 -2
- data/lib/generators/authentication/templates/javascript/tfa_forms.js +3 -5
- data/lib/generators/authentication/templates/models/concerns/authenticateable.rb +2 -2
- data/lib/generators/authentication/templates/models/concerns/otpable.rb +2 -2
- data/lib/generators/authentication/templates/models/concerns/password_resetable.rb +2 -2
- data/lib/generators/authentication/templates/models/otp_credential.rb.erb +2 -2
- data/lib/generators/authentication/templates/models/password_reset_token.rb +2 -2
- data/lib/generators/authentication/templates/models/session.rb.erb +2 -2
- data/lib/generators/authentication/templates/models/tfa_session.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/otp_credential_spec.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/password_reset_token_spec.rb +2 -2
- data/lib/generators/authentication/templates/spec/models/session_spec.rb.erb +10 -11
- data/lib/generators/authentication/templates/spec/models/tfa_session_spec.rb.erb +35 -36
- data/lib/generators/authentication/templates/spec/support/authentication_helpers.rb +2 -2
- data/lib/generators/authentication/templates/spec/system/authentication_spec.rb.erb +2 -2
- data/lib/generators/authentication/templates/spec/system/password_resets_spec.rb.erb +2 -2
- data/lib/generators/authentication/templates/spec/system/tfa_authentication_spec.rb.erb +2 -2
- data/lib/orthodox/version.rb +1 -1
- data/orthodox.gemspec +1 -2
- metadata +6 -52
- data/docs/Authenticateable/ClassMethods.html +0 -105
- data/docs/Authenticateable.html +0 -246
- data/docs/AuthenticationGenerator.html +0 -1335
- data/docs/AuthenticationHelpers.html +0 -194
- data/docs/BaseControllerGenerator.html +0 -247
- data/docs/CoffeescriptGenerator.html +0 -495
- data/docs/ControllerGenerator.html +0 -855
- data/docs/LayoutHelperGenerator.html +0 -397
- data/docs/Orthodox/Railtie.html +0 -124
- data/docs/Orthodox.html +0 -133
- data/docs/OtpCredentialsHelper.html +0 -298
- data/docs/Otpable.html +0 -267
- data/docs/PasswordResetToken.html +0 -324
- data/docs/PasswordResetable.html +0 -193
- data/docs/SassGenerator.html +0 -549
- data/docs/TfaSession.html +0 -476
- data/docs/TwoFactorAuthentication/ClassMethods.html +0 -222
- data/docs/TwoFactorAuthentication.html +0 -121
- data/docs/_config.yml +0 -1
- data/docs/_index.html +0 -265
- data/docs/class_list.html +0 -51
- data/docs/css/common.css +0 -1
- data/docs/css/full_list.css +0 -58
- data/docs/css/style.css +0 -496
- data/docs/file.README.html +0 -311
- data/docs/file_list.html +0 -56
- data/docs/frames.html +0 -17
- data/docs/index.html +0 -311
- data/docs/js/app.js +0 -314
- data/docs/js/full_list.js +0 -216
- data/docs/js/jquery.js +0 -4
- data/docs/method_list.html +0 -555
- data/docs/top-level-namespace.html +0 -112
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Form object for authenticating <%= class_name %> records.
|
4
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
|
4
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
|
+
|
6
6
|
class <%= class_name %>Session
|
7
7
|
|
8
8
|
include ActiveModel::Model
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Form object for handling two-factor authentication sessions
|
2
2
|
#
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
4
|
+
|
5
5
|
class TfaSession
|
6
6
|
include ActiveModel::Model
|
7
7
|
include ActiveModel::Attributes
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
2
|
-
|
1
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
2
|
+
|
3
3
|
#
|
4
4
|
# == Schema Information
|
5
5
|
#
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
2
|
-
|
1
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
2
|
+
|
3
3
|
#
|
4
4
|
# == Schema Information
|
5
5
|
#
|
@@ -1,25 +1,24 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
# (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
4
|
RSpec.describe <%= class_name %>Session, type: :model do
|
6
5
|
|
7
6
|
context "when credentials valid" do
|
8
|
-
|
7
|
+
|
9
8
|
let(:<%= singular_name %>) { create(:<%= singular_name %>) }
|
10
9
|
|
11
10
|
before do
|
12
11
|
subject.email = <%= singular_name %>.email
|
13
12
|
subject.password = <%= singular_name %>.password
|
14
13
|
end
|
15
|
-
|
14
|
+
|
16
15
|
it { is_expected.to be_valid }
|
17
|
-
|
16
|
+
|
18
17
|
it "sets the <%= singular_name %> attribute to the matching record" do
|
19
18
|
subject.valid?
|
20
19
|
expect(subject.<%= singular_name %>).to eql(<%= singular_name %>)
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
end
|
24
23
|
|
25
24
|
context "when credentials are invalid" do
|
@@ -28,18 +27,18 @@ RSpec.describe <%= class_name %>Session, type: :model do
|
|
28
27
|
subject.email = Faker::Internet.safe_email
|
29
28
|
subject.password = "wrong-password"
|
30
29
|
end
|
31
|
-
|
30
|
+
|
32
31
|
it { is_expected.not_to be_valid }
|
33
|
-
|
32
|
+
|
34
33
|
it "sets the <%= singular_name %> attribute to nil" do
|
35
34
|
expect(subject.<%= singular_name %>).to be_nil
|
36
35
|
end
|
37
|
-
|
36
|
+
|
38
37
|
it "has errors on base" do
|
39
38
|
subject.valid?
|
40
39
|
expect(subject.errors[:base]).to be_present
|
41
40
|
end
|
42
|
-
|
41
|
+
|
43
42
|
end
|
44
|
-
|
43
|
+
|
45
44
|
end
|
@@ -1,115 +1,114 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
# (c) Copyright 2019 Katana Code Ltd. All Rights Reserved.
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
4
|
RSpec.describe TfaSession, type: :model do
|
6
|
-
|
5
|
+
|
7
6
|
let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
|
8
|
-
|
7
|
+
|
9
8
|
before do
|
10
9
|
<%= singular_name %>.create_otp_credential!
|
11
10
|
end
|
12
|
-
|
11
|
+
|
13
12
|
describe "#valid?" do
|
14
|
-
|
13
|
+
|
15
14
|
subject { TfaSession.new(record: <%= singular_name %>) }
|
16
|
-
|
15
|
+
|
17
16
|
context "when otp correct" do
|
18
|
-
|
17
|
+
|
19
18
|
before do
|
20
19
|
subject.otp = <%= singular_name %>.otp_credential.send(:current_otp)
|
21
20
|
end
|
22
|
-
|
21
|
+
|
23
22
|
it { is_expected.to be_valid }
|
24
|
-
|
23
|
+
|
25
24
|
end
|
26
25
|
|
27
26
|
context "when otp incorrect" do
|
28
|
-
|
27
|
+
|
29
28
|
before do
|
30
29
|
subject.otp = "12345"
|
31
30
|
end
|
32
|
-
|
31
|
+
|
33
32
|
it { is_expected.to be_invalid }
|
34
|
-
|
33
|
+
|
35
34
|
end
|
36
|
-
|
35
|
+
|
37
36
|
context "when recovery code correct" do
|
38
|
-
|
37
|
+
|
39
38
|
before do
|
40
39
|
subject.recovery_code = <%= singular_name %>.otp_credential.recovery_codes.sample
|
41
40
|
end
|
42
|
-
|
41
|
+
|
43
42
|
it { is_expected.to be_valid }
|
44
|
-
|
43
|
+
|
45
44
|
end
|
46
45
|
|
47
46
|
context "when recovery code incorrect" do
|
48
|
-
|
47
|
+
|
49
48
|
before do
|
50
49
|
subject.recovery_code = "abcd-efgh"
|
51
50
|
end
|
52
|
-
|
51
|
+
|
53
52
|
it { is_expected.to be_invalid }
|
54
|
-
|
53
|
+
|
55
54
|
end
|
56
55
|
end
|
57
|
-
|
58
|
-
|
56
|
+
|
57
|
+
|
59
58
|
describe "#otp?" do
|
60
|
-
|
59
|
+
|
61
60
|
context "when present" do
|
62
61
|
|
63
62
|
before do
|
64
63
|
subject.otp = "12345"
|
65
64
|
end
|
66
|
-
|
65
|
+
|
67
66
|
it "is expected to be truthy" do
|
68
67
|
expect(subject.otp?).to be_truthy
|
69
68
|
end
|
70
|
-
|
69
|
+
|
71
70
|
end
|
72
71
|
|
73
72
|
context "when blank" do
|
74
|
-
|
73
|
+
|
75
74
|
before do
|
76
75
|
subject.otp = nil
|
77
76
|
end
|
78
|
-
|
77
|
+
|
79
78
|
it "is expected to be falsey" do
|
80
79
|
expect(subject.otp?).to be_falsey
|
81
80
|
end
|
82
81
|
|
83
82
|
end
|
84
|
-
|
83
|
+
|
85
84
|
end
|
86
|
-
|
85
|
+
|
87
86
|
describe "#recovery_code?" do
|
88
|
-
|
87
|
+
|
89
88
|
context "when present" do
|
90
89
|
|
91
90
|
before do
|
92
91
|
subject.recovery_code = "abcd-defg"
|
93
92
|
end
|
94
|
-
|
93
|
+
|
95
94
|
it "is expected to be truthy" do
|
96
95
|
expect(subject.recovery_code?).to be_truthy
|
97
96
|
end
|
98
|
-
|
97
|
+
|
99
98
|
end
|
100
99
|
|
101
100
|
context "when blank" do
|
102
|
-
|
101
|
+
|
103
102
|
before do
|
104
103
|
subject.recovery_code = nil
|
105
104
|
end
|
106
|
-
|
105
|
+
|
107
106
|
it "is expected to be falsey" do
|
108
107
|
expect(subject.recovery_code?).to be_falsey
|
109
108
|
end
|
110
109
|
|
111
110
|
end
|
112
|
-
|
111
|
+
|
113
112
|
end
|
114
|
-
|
113
|
+
|
115
114
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
#
|
3
3
|
# Helpers for automating sign-in and out during tests
|
4
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
5
|
-
|
4
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
5
|
+
|
6
6
|
#
|
7
7
|
module AuthenticationHelpers
|
8
8
|
def sign_in(record, **options)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
4
|
+
|
5
5
|
RSpec.describe "<%= plural_class_name %>::Authentication", type: :system do
|
6
6
|
|
7
7
|
let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
4
|
+
|
5
5
|
RSpec.describe "<%= plural_class_name %>::PasswordResets", type: :system do
|
6
6
|
|
7
7
|
include ActiveSupport::Testing::TimeHelpers
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require "rails_helper"
|
2
2
|
|
3
|
-
# Automatically generated by the orthodox gem (https://github.com/
|
4
|
-
|
3
|
+
# Automatically generated by the orthodox gem (https://github.com/bodacious/orthodox)
|
4
|
+
|
5
5
|
RSpec.describe "<%= plural_class_name %>::TfaAuthentication", type: :system do
|
6
6
|
|
7
7
|
let!(:<%= singular_name %>) { create(:<%= singular_name %>) }
|
data/lib/orthodox/version.rb
CHANGED
data/orthodox.gemspec
CHANGED
@@ -21,8 +21,7 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.bindir = "exe"
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib", 'lib/generators']
|
24
|
-
spec.add_runtime_dependency 'rails', '>= 3.0.0'
|
25
24
|
spec.add_runtime_dependency 'slim-rails'
|
26
|
-
spec.add_development_dependency "rake"
|
25
|
+
spec.add_development_dependency "rake"
|
27
26
|
spec.add_development_dependency "rails", ">= 5.0"
|
28
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: orthodox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bodacious
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2021-
|
12
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rails
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: 3.0.0
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 3.0.0
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: slim-rails
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -45,14 +31,14 @@ dependencies:
|
|
45
31
|
requirements:
|
46
32
|
- - ">="
|
47
33
|
- !ruby/object:Gem::Version
|
48
|
-
version: '
|
34
|
+
version: '0'
|
49
35
|
type: :development
|
50
36
|
prerelease: false
|
51
37
|
version_requirements: !ruby/object:Gem::Requirement
|
52
38
|
requirements:
|
53
39
|
- - ">="
|
54
40
|
- !ruby/object:Gem::Version
|
55
|
-
version: '
|
41
|
+
version: '0'
|
56
42
|
- !ruby/object:Gem::Dependency
|
57
43
|
name: rails
|
58
44
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,6 +61,7 @@ extensions: []
|
|
75
61
|
extra_rdoc_files: []
|
76
62
|
files:
|
77
63
|
- ".gitignore"
|
64
|
+
- ".ruby-version"
|
78
65
|
- ".yardopts"
|
79
66
|
- Gemfile
|
80
67
|
- LICENSE.txt
|
@@ -82,39 +69,6 @@ files:
|
|
82
69
|
- Rakefile
|
83
70
|
- bin/console
|
84
71
|
- bin/setup
|
85
|
-
- docs/Authenticateable.html
|
86
|
-
- docs/Authenticateable/ClassMethods.html
|
87
|
-
- docs/AuthenticationGenerator.html
|
88
|
-
- docs/AuthenticationHelpers.html
|
89
|
-
- docs/BaseControllerGenerator.html
|
90
|
-
- docs/CoffeescriptGenerator.html
|
91
|
-
- docs/ControllerGenerator.html
|
92
|
-
- docs/LayoutHelperGenerator.html
|
93
|
-
- docs/Orthodox.html
|
94
|
-
- docs/Orthodox/Railtie.html
|
95
|
-
- docs/OtpCredentialsHelper.html
|
96
|
-
- docs/Otpable.html
|
97
|
-
- docs/PasswordResetToken.html
|
98
|
-
- docs/PasswordResetable.html
|
99
|
-
- docs/SassGenerator.html
|
100
|
-
- docs/TfaSession.html
|
101
|
-
- docs/TwoFactorAuthentication.html
|
102
|
-
- docs/TwoFactorAuthentication/ClassMethods.html
|
103
|
-
- docs/_config.yml
|
104
|
-
- docs/_index.html
|
105
|
-
- docs/class_list.html
|
106
|
-
- docs/css/common.css
|
107
|
-
- docs/css/full_list.css
|
108
|
-
- docs/css/style.css
|
109
|
-
- docs/file.README.html
|
110
|
-
- docs/file_list.html
|
111
|
-
- docs/frames.html
|
112
|
-
- docs/index.html
|
113
|
-
- docs/js/app.js
|
114
|
-
- docs/js/full_list.js
|
115
|
-
- docs/js/jquery.js
|
116
|
-
- docs/method_list.html
|
117
|
-
- docs/top-level-namespace.html
|
118
72
|
- dummy/.gitignore
|
119
73
|
- dummy/.ruby-version
|
120
74
|
- dummy/Gemfile
|
@@ -255,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
255
209
|
- !ruby/object:Gem::Version
|
256
210
|
version: '0'
|
257
211
|
requirements: []
|
258
|
-
rubygems_version: 3.2.
|
212
|
+
rubygems_version: 3.2.22
|
259
213
|
signing_key:
|
260
214
|
specification_version: 4
|
261
215
|
summary: Better Rails generators
|
@@ -1,105 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="utf-8">
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
-
<title>
|
7
|
-
Module: Authenticateable::ClassMethods
|
8
|
-
|
9
|
-
— Orthodox
|
10
|
-
|
11
|
-
</title>
|
12
|
-
|
13
|
-
<link rel="stylesheet" href="../css/style.css" type="text/css" />
|
14
|
-
|
15
|
-
<link rel="stylesheet" href="../css/common.css" type="text/css" />
|
16
|
-
|
17
|
-
<script type="text/javascript">
|
18
|
-
pathId = "Authenticateable::ClassMethods";
|
19
|
-
relpath = '../';
|
20
|
-
</script>
|
21
|
-
|
22
|
-
|
23
|
-
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
24
|
-
|
25
|
-
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
26
|
-
|
27
|
-
|
28
|
-
</head>
|
29
|
-
<body>
|
30
|
-
<div class="nav_wrap">
|
31
|
-
<iframe id="nav" src="../class_list.html?1"></iframe>
|
32
|
-
<div id="resizer"></div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div id="main" tabindex="-1">
|
36
|
-
<div id="header">
|
37
|
-
<div id="menu">
|
38
|
-
|
39
|
-
<a href="../_index.html">Index (C)</a> »
|
40
|
-
<span class='title'><span class='object_link'><a href="../Authenticateable.html" title="Authenticateable (module)">Authenticateable</a></span></span>
|
41
|
-
»
|
42
|
-
<span class="title">ClassMethods</span>
|
43
|
-
|
44
|
-
</div>
|
45
|
-
|
46
|
-
<div id="search">
|
47
|
-
|
48
|
-
<a class="full_list_link" id="class_list_link"
|
49
|
-
href="../class_list.html">
|
50
|
-
|
51
|
-
<svg width="24" height="24">
|
52
|
-
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
-
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
-
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
-
</svg>
|
56
|
-
</a>
|
57
|
-
|
58
|
-
</div>
|
59
|
-
<div class="clear"></div>
|
60
|
-
</div>
|
61
|
-
|
62
|
-
<div id="content"><h1>Module: Authenticateable::ClassMethods
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
</h1>
|
67
|
-
<div class="box_info">
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<dl>
|
80
|
-
<dt>Defined in:</dt>
|
81
|
-
<dd>lib/generators/authentication/templates/models/concerns/authenticateable.rb</dd>
|
82
|
-
</dl>
|
83
|
-
|
84
|
-
</div>
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
</div>
|
96
|
-
|
97
|
-
<div id="footer">
|
98
|
-
Generated on Thu Aug 13 16:36:42 2020 by
|
99
|
-
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
100
|
-
0.9.24 (ruby-2.6.6).
|
101
|
-
</div>
|
102
|
-
|
103
|
-
</div>
|
104
|
-
</body>
|
105
|
-
</html>
|