nyauth 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +5 -3
  4. data/app/controllers/nyauth/passwords_controller.rb +3 -0
  5. data/app/controllers/nyauth/sessions_controller.rb +3 -1
  6. data/app/helpers/nyauth/application_helper.rb +1 -1
  7. data/lib/nyauth/version.rb +1 -1
  8. data/spec/dummy/app/controllers/application_controller.rb +1 -0
  9. data/spec/dummy/app/views/layouts/application.html.erb +6 -1
  10. data/spec/dummy/config/initializers/nyauth.rb +3 -0
  11. data/spec/dummy/db/test.sqlite3 +0 -0
  12. data/spec/dummy/log/development.log +3661 -0
  13. data/spec/dummy/log/test.log +16319 -0
  14. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/00R4IbuMWUgW0TswtkCnDqB8MUJqvz76FgkmbrLPTd8.cache +0 -0
  15. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/1-v7tFLPkD6uyCpAKjAKORwPg5YalyY-SYwjNGTiHQo.cache +1 -0
  16. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/122B1KZyQmgyJoX7uc4JINcUDUmcMHJsbf5JopBIpSg.cache +2 -0
  17. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/2W23wCoDaNvkpc-htXrPJ_4wwRXsCB8sDUi-vlecXRY.cache +1 -0
  18. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8UAh9fJot2eROIl2PFflmIp2Q0G3oNNzBxCYx6AWaTw.cache +3 -0
  19. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/8Ze9kDXrEQxOBazUvSE0NM5zLGZnHFsDskzK_P47vk4.cache +1 -0
  20. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Ald0qisxC6krU6CCGUtsVQJwZ786HWf2a4VJnhi2Lrw.cache +1 -0
  21. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Bx8MbffT9WQGgl0DcTM5n11UlQabeTzIyqKGm2snGus.cache +1 -0
  22. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/CjFGeOmtoOvDUwEi78Mx3PtuchpMqlfecazo-n8RsAQ.cache +0 -0
  23. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/DK6c5xJ8kSeXSqJlndPmMohu6AMbxDTYw3amSuVkoTs.cache +2 -0
  24. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/E16A8LE9OYp6k-WBc2Egdmn6XL_-ipcmDOYBOfBITqs.cache +2 -0
  25. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/EGILbSm92CBXW0Z6Mp6o2YygxS4b8Hhd2CW8igzKuRM.cache +1 -0
  26. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/FIPwj786RByADaWtmUkp2eeWQvQ_QmX1ER1sGGOKgqo.cache +1 -0
  27. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Fo9EHolUACmT7eKdJVmIzktbVgFRBZQkcCGHFfpD7u0.cache +1 -0
  28. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/KiPxsMrAEr8OMX4H_Q8MSOgJ0PuFTQf2yX0S4kZsDVs.cache +1 -0
  29. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/Tpj_x0CkqGAEMDgH-JGBkdkajznkLbbiVVZOxEqURxU.cache +0 -0
  30. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZM48tpiRiDxrKqKUvohWJfOeqwp5RsXgtKY84fW-qEE.cache +0 -0
  31. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ZcwAlVnn77peLsFoZbCh7F7wpmxPhsehRs1frol6gfU.cache +1 -0
  32. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/h1z_izpQoHamMnv_RoNWN6gT2x3tY11ndWa7uVWkiaE.cache +0 -0
  33. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/k-V4Qz1zxawVTQoo00igdXRPgv4xOiV8fQsQtj8uDhA.cache +0 -0
  34. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/lANr4VX8LDWQ3kMj0yoqyqiwK3SEqtIXkA-22639ZQQ.cache +2 -0
  35. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/mKfHoait9-j98PxObraQnsOWSk7xeFfrgppKbFtsUP0.cache +1 -0
  36. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/s0L4Qc1LxOsV_VIoN33m851q4i5lQVM1ygIhke4UJhM.cache +2 -0
  37. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/sjZSTu90VegaTEOBnEbgI9A0_THfWp-_QVzTR7p7m_k.cache +1 -0
  38. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/y7TMQhIN-uRk0HFOYLmEtgTZdktzieFoy6OGzULuesI.cache +0 -0
  39. data/spec/dummy/tmp/cache/assets/development/sprockets/v3.0/ysMIP1GiNEslwSMFx4V6kVDb4UFG1mgq0U7Pjh2AIzY.cache +1 -0
  40. data/spec/dummy/tmp/capybara/capybara-201507112215421960933759.html +1 -0
  41. data/spec/dummy/tmp/capybara/capybara-20150711221603434494315.html +1 -0
  42. data/spec/dummy/tmp/capybara/capybara-201507112216361494719582.html +21 -0
  43. data/spec/dummy/tmp/capybara/capybara-201507112233431710633186.html +20 -0
  44. metadata +64 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78c8dca6c49fd4abe898394914257767fa4c002f
4
- data.tar.gz: 52dbfeeaaab4f1109d86565598db322f8978f5eb
3
+ metadata.gz: 2ad3b4a881cc5ba9efe2e7230467642068906b52
4
+ data.tar.gz: 50d8fdee969e3210e9a54217bcc0b146bec4fb1a
5
5
  SHA512:
6
- metadata.gz: a53bafdb9cce12f04697e1921d2b7ce5a2238f259884447929eb38c420bb11391079730d65aa760f6784dea57346facb4052632763a9954a1d6859ef17661c37
7
- data.tar.gz: f7e05ea17062c114207d436177a8ec31d674e7ac239d2030611ca99d3b43b76007cad7600954aa4dbdcdecb26da4eec8ab175b353b1e13c6016d195dacbd0ba5
6
+ metadata.gz: da27181102d3320122ca94bcc6b9f8bd1864675b8d49f0e697a93fd01a4d53dc1f37878441ba96bdb4149e4bb81e7702664726d998929600f91a9e0ac386625f
7
+ data.tar.gz: 3dd04d685f016d32c57ce1d80b6ac9e5058f6e178be9227c03a8ba085928c8a5f54367d476f0fbaad3d70e24bc13ca96fc7a5558a2b7eb7d3749ef52789624a0
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 koshikawa
1
+ Copyright 2015 ppworks
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Simple & modualbe authentication gem
4
4
 
5
+ [CHANGE LOG](https://github.com/ppworks/nyauth/blob/master/CHANGELOG.md)
6
+
5
7
  ### application_controller.rb
6
8
 
7
9
  ```ruby
@@ -94,7 +96,7 @@ new_reset_password_request GET /reset_password_requests/new(.:format)
94
96
  PUT /reset_passwords/:reset_password_key(.:format) nyauth/reset_passwords#update
95
97
  ```
96
98
 
97
- ```
99
+ ```ruby
98
100
  new_session_path_for(:user) # /session/new
99
101
  new_session_path_for(:admin) # /admin/session/new
100
102
  ```
@@ -127,7 +129,7 @@ export NYAUTH_ENCRYPTION_SECRET=`bundle exec rake secret`
127
129
 
128
130
  Or edit `config/initializers/nyauth.rb`
129
131
 
130
- ```
132
+ ```ruby
131
133
  nyauth.configure do |config|
132
134
  config.encryption_secret = ENV['NYAUTH_ENCRYPTION_SECRET'] || ENV['SECRET_KEY_BASE']
133
135
  config.confirmation_expire_limit = 1.hour
@@ -154,7 +156,7 @@ end
154
156
 
155
157
  I18n
156
158
 
157
- ```
159
+ ```yaml
158
160
  ja:
159
161
  flash:
160
162
  nyauth:
@@ -2,6 +2,9 @@ module Nyauth
2
2
  class PasswordsController < ApplicationController
3
3
  include Nyauth::ApplicationConcern
4
4
  include Nyauth::ClientConcern
5
+ include Nyauth::SessionConcern
6
+ before_action -> { require_authentication! as: client_name }
7
+
5
8
  respond_to :html, :json
6
9
  before_action :set_client
7
10
 
@@ -2,6 +2,8 @@ module Nyauth
2
2
  class SessionsController < ApplicationController
3
3
  include Nyauth::ApplicationConcern
4
4
  include Nyauth::ClientConcern
5
+ include Nyauth::SessionConcern
6
+ before_action -> { require_authentication! as: client_name }
5
7
  allow_everyone only: [:new, :create]
6
8
  respond_to :html, :json
7
9
  before_action :set_session_service
@@ -16,7 +18,7 @@ module Nyauth
16
18
 
17
19
  def destroy
18
20
  sign_out
19
- respond_with @session_service, location: Nyauth.configuration.redirect_path_after_sign_out.call(client_name) || new_session_path
21
+ respond_with @session_service, location: Nyauth.configuration.redirect_path_after_sign_out.call(client_name) || new_session_path_for(client_name)
20
22
  end
21
23
 
22
24
  private
@@ -35,7 +35,7 @@ module Nyauth
35
35
  path = @__candidates.grep(/\A#{client_name}_#{feature}_path\z/).first
36
36
  end
37
37
  return nil unless path
38
- __send__(path, *args)
38
+ main_app.__send__(path, *args)
39
39
  end
40
40
 
41
41
  def root_path
@@ -1,3 +1,3 @@
1
1
  module Nyauth
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  class ApplicationController < ActionController::Base
2
+ include Nyauth::ApplicationConcern
2
3
  include Nyauth::SessionConcern
3
4
  self.responder = Nyauth::AppResponder
4
5
  # Prevent CSRF attacks by raising an exception.
@@ -16,6 +16,11 @@
16
16
  <%= flash[:alert] %>
17
17
  <% end %>
18
18
  <%= link_to "URL helper on application", posts_path %>
19
- <%= link_to 'Sign out', nyauth.session_path, class: 'pure-menu-link', method: :delete %>
19
+ <% if signed_in?(as: :user) %>
20
+ <%= link_to 'Sign out', session_path_for(:user), class: 'pure-menu-link', method: :delete %>
21
+ <% end %>
22
+ <% if signed_in?(as: :admin) %>
23
+ <%= link_to 'Sign out', session_path_for(:admin), class: 'pure-menu-link', method: :delete %>
24
+ <% end %>
20
25
  </body>
21
26
  </html>
@@ -0,0 +1,3 @@
1
+ Nyauth.configure do |config|
2
+ config.encryption_secret = ENV['NYAUTH_ENCRYPTION_SECRET'] || 'rails6dd08eff1c2cf5aecb54cb1a97266817b58cc27f06be9e95918c06607d3950d623a4fd4c0c306d2216cdaf3f99871e21e0e975a5e64ef5cf286b68ed8d7379a4'
3
+ end
Binary file