rodauth-rails 0.9.0 → 0.9.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +30 -9
- data/lib/generators/rodauth/migration/base.erb +2 -2
- data/lib/rodauth/rails/app.rb +1 -1
- data/lib/rodauth/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8f8aec1dbdc745a530aabec0d63bc2681499dd36f8185faed9ea09e7184636e
|
4
|
+
data.tar.gz: fbc5a75976a922978a6e37fee3bef8e7f04bb0a9a324066afdf79172b33f00e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89d2f6ad377ba8e3f18bc747c3bfdf53e97c1a29f2731036987e5f7c1fde14db89732cda2d09026a153d81eabe26e51e021a129f02517d4d5582fcaf392876ca
|
7
|
+
data.tar.gz: 648b1297a9569b436113b5921a9ae37944d808ed42a03ef57a75452a74143dcc493e7d9c34a12f31f780745db5d2b1365d5a7b602dfa303571961730566852f4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 0.9.1 (2021-02-10)
|
2
|
+
|
3
|
+
* Fix flash integration being loaded for API-only apps and causing an error (@dmitryzuev)
|
4
|
+
|
5
|
+
* Change account status column default to `unverified` in migration to match Rodauth's default (@basabin54)
|
6
|
+
|
1
7
|
## 0.9.0 (2021-02-07)
|
2
8
|
|
3
9
|
* Load Roda's JSON support by default, so that enabling `json`/`jwt` feature is all that's needed (@janko)
|
data/README.md
CHANGED
@@ -729,6 +729,24 @@ class RodauthApp < Rodauth::Rails::App
|
|
729
729
|
end
|
730
730
|
```
|
731
731
|
|
732
|
+
If you need Cross-Origin Resource Sharing and/or JWT refresh tokens, enable the
|
733
|
+
corresponding Rodauth features and create the necessary tables:
|
734
|
+
|
735
|
+
```sh
|
736
|
+
$ rails generate rodauth:migration jwt_refresh
|
737
|
+
$ rails db:migrate
|
738
|
+
```
|
739
|
+
```rb
|
740
|
+
# app/lib/rodauth_app.rb
|
741
|
+
class RodauthApp < Rodauth::Rails::App
|
742
|
+
configure do
|
743
|
+
# ...
|
744
|
+
enable :jwt, :jwt_cors, :jwt_refresh
|
745
|
+
# ...
|
746
|
+
end
|
747
|
+
end
|
748
|
+
```
|
749
|
+
|
732
750
|
## OmniAuth
|
733
751
|
|
734
752
|
While Rodauth doesn't yet come with [OmniAuth] integration, we can build one
|
@@ -821,7 +839,7 @@ class RodauthController < ApplicationController
|
|
821
839
|
|
822
840
|
# create new account if it doesn't exist
|
823
841
|
unless account
|
824
|
-
account = Account.create!(email: auth["info"]["email"])
|
842
|
+
account = Account.create!(email: auth["info"]["email"], status: rodauth.account_open_status_value)
|
825
843
|
end
|
826
844
|
|
827
845
|
# create new identity if it doesn't exist
|
@@ -873,17 +891,19 @@ end
|
|
873
891
|
|
874
892
|
When developing custom extensions for Rodauth inside your Rails project, it's
|
875
893
|
better to use plain modules (at least in the beginning), because Rodauth
|
876
|
-
feature
|
894
|
+
feature design doesn't yet support Zeitwerk reloading well. Here is
|
895
|
+
an example of an LDAP authentication extension that uses the
|
896
|
+
[simple_ldap_authenticator] gem.
|
877
897
|
|
878
898
|
```rb
|
879
|
-
# app/lib/
|
880
|
-
module
|
881
|
-
def
|
882
|
-
|
899
|
+
# app/lib/rodauth_ldap.rb
|
900
|
+
module RodauthLdap
|
901
|
+
def require_bcrypt?
|
902
|
+
false
|
883
903
|
end
|
884
904
|
|
885
|
-
def
|
886
|
-
|
905
|
+
def password_match?(password)
|
906
|
+
SimpleLdapAuthenticator.valid?(account[:email], password)
|
887
907
|
end
|
888
908
|
end
|
889
909
|
```
|
@@ -893,7 +913,7 @@ class RodauthApp < Rodauth::Rails::App
|
|
893
913
|
configure do
|
894
914
|
# ...
|
895
915
|
auth_class_eval do
|
896
|
-
include
|
916
|
+
include RodauthLdap
|
897
917
|
end
|
898
918
|
# ...
|
899
919
|
end
|
@@ -1064,3 +1084,4 @@ conduct](https://github.com/janko/rodauth-rails/blob/master/CODE_OF_CONDUCT.md).
|
|
1064
1084
|
[session_expiration]: http://rodauth.jeremyevans.net/rdoc/files/doc/session_expiration_rdoc.html
|
1065
1085
|
[single_session]: http://rodauth.jeremyevans.net/rdoc/files/doc/single_session_rdoc.html
|
1066
1086
|
[account_expiration]: http://rodauth.jeremyevans.net/rdoc/files/doc/account_expiration_rdoc.html
|
1087
|
+
[simple_ldap_authenticator]: https://github.com/jeremyevans/simple_ldap_authenticator
|
@@ -5,11 +5,11 @@ enable_extension "citext"
|
|
5
5
|
create_table :accounts<%= primary_key_type %> do |t|
|
6
6
|
<% case activerecord_adapter -%>
|
7
7
|
<% when "postgresql" -%>
|
8
|
-
t.citext :email, null: false, index: { unique: true, where: "status IN ('
|
8
|
+
t.citext :email, null: false, index: { unique: true, where: "status IN ('unverified', 'verified')" }
|
9
9
|
<% else -%>
|
10
10
|
t.string :email, null: false, index: { unique: true }
|
11
11
|
<% end -%>
|
12
|
-
t.string :status, null: false, default: "
|
12
|
+
t.string :status, null: false, default: "unverified"
|
13
13
|
end
|
14
14
|
|
15
15
|
# Used if storing password hashes in a separate table (default)
|
data/lib/rodauth/rails/app.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rodauth-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-02-
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|