rodauth-rails 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60fda35b195285a7c9cc14e07153d80faa9e939cf2944fbb04e1360baf30e306
4
- data.tar.gz: 1f89bcfff28e6d08287fa67a9fe9228a2d61f15a8a9cdecb9fcf138137d72c47
3
+ metadata.gz: b8f8aec1dbdc745a530aabec0d63bc2681499dd36f8185faed9ea09e7184636e
4
+ data.tar.gz: fbc5a75976a922978a6e37fee3bef8e7f04bb0a9a324066afdf79172b33f00e9
5
5
  SHA512:
6
- metadata.gz: 8e4ed3afbe7a114ba36f19541d1c8c8ee62de07526400230b1386f027b05876cd78ad88bdb40cae9767e74f83d1532d4939d97d03657662933f81d7086df34d9
7
- data.tar.gz: cae1fc15a86f1b2e2423a8e54f36b844f610ba23ff74fd9ced132200e9816260028682c0efea1dcf19cf8a722a7ae49882c8d31c670e268e229117b4f6fb84f2
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 API doesn't yet support Zeitwerk reloading well.
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/rodauth_argon2.rb
880
- module RodauthArgon2
881
- def password_hash(password)
882
- Argon2::Password.create(password, t_cost: password_hash_cost, m_cost: password_hash_cost)
899
+ # app/lib/rodauth_ldap.rb
900
+ module RodauthLdap
901
+ def require_bcrypt?
902
+ false
883
903
  end
884
904
 
885
- def password_hash_match?(hash, password)
886
- Argon2::Password.verify_password(password, hash)
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 RodauthArgon2
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 ('verified', 'unverified')" }
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: "verified"
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)
@@ -12,7 +12,7 @@ module Rodauth
12
12
  plugin :hooks
13
13
  plugin :render, layout: false
14
14
 
15
- if defined?(ActionDispatch::Flash) # not in API-only mode
15
+ unless Rodauth::Rails.api_only?
16
16
  require "rodauth/rails/app/flash"
17
17
  plugin Flash
18
18
  end
@@ -1,5 +1,5 @@
1
1
  module Rodauth
2
2
  module Rails
3
- VERSION = "0.9.0"
3
+ VERSION = "0.9.1"
4
4
  end
5
5
  end
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.0
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-07 00:00:00.000000000 Z
11
+ date: 2021-02-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties