devise_oauth2_rails4 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +6 -0
  3. data/.ruby-gemset +1 -1
  4. data/CONTRIBUTORS.txt +1 -0
  5. data/README.md +2 -2
  6. data/Rakefile +3 -3
  7. data/app/controllers/devise/{oauth2_providable → oauth2}/authorizations_controller.rb +8 -2
  8. data/app/controllers/devise/oauth2/tokens_controller.rb +23 -0
  9. data/app/models/devise/oauth2/access_token.rb +39 -0
  10. data/app/models/devise/oauth2/authorization_code.rb +3 -0
  11. data/app/models/devise/oauth2/client.rb +29 -0
  12. data/app/models/devise/{oauth2_providable → oauth2}/refresh_token.rb +1 -1
  13. data/app/views/devise/{oauth2_providable → oauth2}/authorizations/_form.html.erb +1 -0
  14. data/app/views/devise/{oauth2_providable → oauth2}/authorizations/error.html.erb +0 -0
  15. data/app/views/devise/oauth2/authorizations/new.html.erb +8 -0
  16. data/config/routes.rb +2 -1
  17. data/db/migrate/20111014160714_create_devise_oauth2_providable_schema.rb +13 -8
  18. data/devise_oauth2_rails4.gemspec +32 -0
  19. data/lib/devise/oauth2/engine.rb +16 -0
  20. data/lib/devise/{oauth2_providable → oauth2}/expirable_token.rb +4 -4
  21. data/lib/devise/{oauth2_providable → oauth2}/models/oauth2_authorization_code_grantable.rb +0 -0
  22. data/lib/devise/{oauth2_providable → oauth2}/models/oauth2_password_grantable.rb +0 -0
  23. data/lib/devise/{oauth2_providable → oauth2}/models/oauth2_providable.rb +3 -3
  24. data/lib/devise/{oauth2_providable → oauth2}/models/oauth2_refresh_token_grantable.rb +0 -0
  25. data/lib/devise/{oauth2_providable → oauth2}/strategies/oauth2_authorization_code_grant_type_strategy.rb +1 -1
  26. data/lib/devise/{oauth2_providable → oauth2}/strategies/oauth2_grant_type_strategy.rb +1 -1
  27. data/lib/devise/{oauth2_providable → oauth2}/strategies/oauth2_password_grant_type_strategy.rb +1 -1
  28. data/lib/devise/{oauth2_providable → oauth2}/strategies/oauth2_providable_strategy.rb +3 -3
  29. data/lib/devise/{oauth2_providable → oauth2}/strategies/oauth2_refresh_token_grant_type_strategy.rb +2 -2
  30. data/lib/devise/oauth2/version.rb +5 -0
  31. data/lib/devise_oauth2_rails4.rb +41 -0
  32. data/lib/generators/devise/oauth2/migrations_generator.rb +16 -0
  33. data/lib/generators/devise/oauth2/views_generator.rb +11 -0
  34. data/rails/tasks/engine.rake +17 -0
  35. data/spec/controllers/authorizations_controller_spec.rb +1 -1
  36. data/spec/controllers/protected_controller_spec.rb +1 -1
  37. data/spec/dummy/app/models/user.rb +1 -1
  38. data/spec/dummy/app/views/devise/confirmations/new.html.erb +12 -0
  39. data/spec/dummy/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  40. data/spec/dummy/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  41. data/spec/dummy/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  42. data/spec/dummy/app/views/devise/passwords/edit.html.erb +16 -0
  43. data/spec/dummy/app/views/devise/passwords/new.html.erb +12 -0
  44. data/spec/dummy/app/views/devise/registrations/edit.html.erb +29 -0
  45. data/spec/dummy/app/views/devise/registrations/new.html.erb +18 -0
  46. data/spec/dummy/app/views/devise/sessions/new.html.erb +17 -0
  47. data/spec/dummy/app/views/devise/shared/_links.erb +25 -0
  48. data/spec/dummy/app/views/devise/unlocks/new.html.erb +12 -0
  49. data/spec/dummy/config/application.rb +1 -1
  50. data/spec/dummy/config/initializers/devise.rb +86 -42
  51. data/spec/dummy/config/locales/devise.en.yml +49 -48
  52. data/spec/dummy/config/routes.rb +1 -1
  53. data/spec/dummy/db/migrate/{20111014161437_create_devise_oauth2_providable_schema.rb → 20140306063000_create_devise_oauth2_providable_schema.rb} +14 -9
  54. data/spec/dummy/db/schema.rb +34 -28
  55. data/spec/factories/client_factory.rb +6 -4
  56. data/spec/factories/user_factory.rb +4 -4
  57. data/spec/integration/oauth2_authorization_token_grant_type_strategy_spec.rb +2 -2
  58. data/spec/integration/oauth2_password_grant_type_strategy_spec.rb +2 -2
  59. data/spec/integration/oauth2_refresh_token_grant_type_strategy_spec.rb +2 -2
  60. data/spec/lib/devise_oauth2_providable_spec.rb +1 -1
  61. data/spec/models/access_token_spec.rb +5 -5
  62. data/spec/models/authorization_code_spec.rb +2 -2
  63. data/spec/models/client_spec.rb +2 -2
  64. data/spec/models/refresh_token_spec.rb +3 -3
  65. data/spec/routing/authorizations_routing_spec.rb +1 -1
  66. data/spec/routing/tokens_routing_spec.rb +1 -1
  67. metadata +70 -45
  68. data/app/controllers/devise/oauth2_providable/tokens_controller.rb +0 -19
  69. data/app/models/devise/oauth2_providable/access_token.rb +0 -25
  70. data/app/models/devise/oauth2_providable/authorization_code.rb +0 -3
  71. data/app/models/devise/oauth2_providable/client.rb +0 -25
  72. data/app/views/devise/oauth2_providable/authorizations/new.html.erb +0 -4
  73. data/lib/devise/oauth2_providable/engine.rb +0 -16
  74. data/lib/devise/oauth2_providable/version.rb +0 -5
  75. data/lib/devise_oauth2_providable.rb +0 -41
  76. data/lib/generators/devise_oauth2/views_generator.rb +0 -7
@@ -0,0 +1,12 @@
1
+ <h2>Forgot your password?</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => password_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <div><%= f.submit "Send me reset password instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,29 @@
1
+ <h2>Edit <%= resource_name.to_s.humanize %></h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => { :method => :put }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
10
+ <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
11
+ <% end %>
12
+
13
+ <div><%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
14
+ <%= f.password_field :password, :autocomplete => "off" %></div>
15
+
16
+ <div><%= f.label :password_confirmation %><br />
17
+ <%= f.password_field :password_confirmation %></div>
18
+
19
+ <div><%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
20
+ <%= f.password_field :current_password %></div>
21
+
22
+ <div><%= f.submit "Update" %></div>
23
+ <% end %>
24
+
25
+ <h3>Cancel my account</h3>
26
+
27
+ <p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), :data => { :confirm => "Are you sure?" }, :method => :delete %></p>
28
+
29
+ <%= link_to "Back", :back %>
@@ -0,0 +1,18 @@
1
+ <h2>Sign up</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <div><%= f.label :password %><br />
10
+ <%= f.password_field :password %></div>
11
+
12
+ <div><%= f.label :password_confirmation %><br />
13
+ <%= f.password_field :password_confirmation %></div>
14
+
15
+ <div><%= f.submit "Sign up" %></div>
16
+ <% end %>
17
+
18
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,17 @@
1
+ <h2>Sign in</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => session_path(resource_name)) do |f| %>
4
+ <div><%= f.label :email %><br />
5
+ <%= f.email_field :email, :autofocus => true %></div>
6
+
7
+ <div><%= f.label :password %><br />
8
+ <%= f.password_field :password %></div>
9
+
10
+ <% if devise_mapping.rememberable? -%>
11
+ <div><%= f.check_box :remember_me %> <%= f.label :remember_me %></div>
12
+ <% end -%>
13
+
14
+ <div><%= f.submit "Sign in" %></div>
15
+ <% end %>
16
+
17
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,25 @@
1
+ <%- if controller_name != 'sessions' %>
2
+ <%= link_to "Sign in", new_session_path(resource_name) %><br />
3
+ <% end -%>
4
+
5
+ <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6
+ <%= link_to "Sign up", new_registration_path(resource_name) %><br />
7
+ <% end -%>
8
+
9
+ <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10
+ <%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
11
+ <% end -%>
12
+
13
+ <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14
+ <%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
15
+ <% end -%>
16
+
17
+ <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18
+ <%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
19
+ <% end -%>
20
+
21
+ <%- if devise_mapping.omniauthable? %>
22
+ <%- resource_class.omniauth_providers.each do |provider| %>
23
+ <%= link_to "Sign in with #{provider.to_s.titleize}", omniauth_authorize_path(resource_name, provider) %><br />
24
+ <% end -%>
25
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, :as => resource_name, :url => unlock_path(resource_name), :html => { :method => :post }) do |f| %>
4
+ <%= devise_error_messages! %>
5
+
6
+ <div><%= f.label :email %><br />
7
+ <%= f.email_field :email, :autofocus => true %></div>
8
+
9
+ <div><%= f.submit "Resend unlock instructions" %></div>
10
+ <% end %>
11
+
12
+ <%= render "devise/shared/links" %>
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
3
3
  require 'rails/all'
4
4
 
5
5
  Bundler.require
6
- require "devise_oauth2_providable"
6
+ require "devise_oauth2_rails4"
7
7
 
8
8
  module Dummy
9
9
  class Application < Rails::Application
@@ -1,13 +1,19 @@
1
- # Use this hook to configure devise mailer, warden hooks and so forth. The first
2
- # four configuration values can also be set straight in your models.
1
+ # Use this hook to configure devise mailer, warden hooks and so forth.
2
+ # Many of these configuration options can be set straight in your model.
3
3
  Devise.setup do |config|
4
+ # The secret key used by Devise. Devise uses this key to generate
5
+ # random tokens. Changing this key will render invalid all existing
6
+ # confirmation, reset password and unlock tokens in the database.
7
+ # config.secret_key = 'bd1335c32de6db5eb2477682f71cbaefb8de4a29ceca15f186a0e6ec9d343086e4506809633d7c756f3badfbbf1343ebd261d832e805af201cb8e49ea6938bba'
8
+
4
9
  # ==> Mailer Configuration
5
10
  # Configure the e-mail address which will be shown in Devise::Mailer,
6
- # note that it will be overwritten if you use your own mailer class with default "from" parameter.
7
- config.mailer_sender = "please-change-me-at-config-initializers-devise@example.com"
11
+ # note that it will be overwritten if you use your own mailer class
12
+ # with default "from" parameter.
13
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
8
14
 
9
15
  # Configure the class responsible to send e-mails.
10
- # config.mailer = "Devise::Mailer"
16
+ # config.mailer = 'Devise::Mailer'
11
17
 
12
18
  # ==> ORM configuration
13
19
  # Load and configure the ORM. Supports :active_record (default) and
@@ -43,22 +49,42 @@ Devise.setup do |config|
43
49
  config.strip_whitespace_keys = [ :email ]
44
50
 
45
51
  # Tell if authentication through request.params is enabled. True by default.
52
+ # It can be set to an array that will enable params authentication only for the
53
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
54
+ # enable it only for database (email + password) authentication.
46
55
  # config.params_authenticatable = true
47
56
 
48
- # Tell if authentication through HTTP Basic Auth is enabled. False by default.
57
+ # Tell if authentication through HTTP Auth is enabled. False by default.
58
+ # It can be set to an array that will enable http authentication only for the
59
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
60
+ # enable it only for database authentication. The supported strategies are:
61
+ # :database = Support basic authentication with authentication key + password
49
62
  # config.http_authenticatable = false
50
63
 
51
64
  # If http headers should be returned for AJAX requests. True by default.
52
65
  # config.http_authenticatable_on_xhr = true
53
66
 
54
- # The realm used in Http Basic Authentication. "Application" by default.
55
- # config.http_authentication_realm = "Application"
67
+ # The realm used in Http Basic Authentication. 'Application' by default.
68
+ # config.http_authentication_realm = 'Application'
56
69
 
57
70
  # It will change confirmation, password recovery and other workflows
58
71
  # to behave the same regardless if the e-mail provided was right or wrong.
59
72
  # Does not affect registerable.
60
73
  # config.paranoid = true
61
74
 
75
+ # By default Devise will store the user in session. You can skip storage for
76
+ # particular strategies by setting this option.
77
+ # Notice that if you are skipping storage for all authentication paths, you
78
+ # may want to disable generating routes to Devise's sessions controller by
79
+ # passing :skip => :sessions to `devise_for` in your config/routes.rb
80
+ config.skip_session_storage = [:http_auth]
81
+
82
+ # By default, Devise cleans up the CSRF token on authentication to
83
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
84
+ # requests for sign in and sign up, you need to get a new CSRF token
85
+ # from the server. You can disable this option at your own risk.
86
+ # config.clean_up_csrf_token_on_authentication = true
87
+
62
88
  # ==> Configuration for :database_authenticatable
63
89
  # For bcrypt, this is the cost for hashing the password and defaults to 10. If
64
90
  # using other encryptors, it sets how many times you want the password re-encrypted.
@@ -69,15 +95,29 @@ Devise.setup do |config|
69
95
  config.stretches = Rails.env.test? ? 1 : 10
70
96
 
71
97
  # Setup a pepper to generate the encrypted password.
72
- # config.pepper = "93ff79506ade6b0ede7721989b9a4fe887fdde24c6713d8db3d18f40ca5f93f74663c7fed845665a296ecfc3aec66e6fbc7419df702d49de3af2ae05bf7231c0"
98
+ # config.pepper = '7b20ef05366d21e56a8be2b77646687f363d4643c8a5c8d72950e9efb6d85b45e41fa791a1f57f578531b569ba7a300d1c255396f60c5472e0c47295d53f1e95'
73
99
 
74
100
  # ==> Configuration for :confirmable
75
101
  # A period that the user is allowed to access the website even without
76
- # confirming his account. For instance, if set to 2.days, the user will be
77
- # able to access the website for two days without confirming his account,
102
+ # confirming their account. For instance, if set to 2.days, the user will be
103
+ # able to access the website for two days without confirming their account,
78
104
  # access will be blocked just in the third day. Default is 0.days, meaning
79
- # the user cannot access the website without confirming his account.
80
- # config.confirm_within = 2.days
105
+ # the user cannot access the website without confirming their account.
106
+ # config.allow_unconfirmed_access_for = 2.days
107
+
108
+ # A period that the user is allowed to confirm their account before their
109
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
110
+ # their account within 3 days after the mail was sent, but on the fourth day
111
+ # their account can't be confirmed with the token any more.
112
+ # Default is nil, meaning there is no restriction on how long a user can take
113
+ # before confirming their account.
114
+ # config.confirm_within = 3.days
115
+
116
+ # If true, requires any email changes to be confirmed (exactly the same way as
117
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
118
+ # db field (see migrations). Until confirmed new email is stored in
119
+ # unconfirmed email column, and copied to email column on successful confirmation.
120
+ config.reconfirmable = true
81
121
 
82
122
  # Defines which key will be used when confirming an account
83
123
  # config.confirmation_keys = [ :email ]
@@ -86,26 +126,19 @@ Devise.setup do |config|
86
126
  # The time the user will be remembered without asking for credentials again.
87
127
  # config.remember_for = 2.weeks
88
128
 
89
- # If true, a valid remember token can be re-used between multiple browsers.
90
- # config.remember_across_browsers = true
91
-
92
129
  # If true, extends the user's remember period when remembered via cookie.
93
130
  # config.extend_remember_period = false
94
131
 
95
- # If true, uses the password salt as remember token. This should be turned
96
- # to false if you are not using database authenticatable.
97
- config.use_salt_as_remember_token = true
98
-
99
- # Options to be passed to the created cookie. For instance, you can set
132
+ config.secret_key = '3fce8b37a78d4c76d30c10117db7dfb794b9e7387f55fccc3b67faff5b14d9d5d44b688e4a63b55aee96d54c4b1319c8d05c2bcce35233d550ffe3162c06433e' # Options to be passed to the created cookie. For instance, you can set
100
133
  # :secure => true in order to force SSL only cookies.
101
- # config.cookie_options = {}
134
+ # config.rememberable_options = {}
102
135
 
103
136
  # ==> Configuration for :validatable
104
- # Range for password length. Default is 6..128.
105
- # config.password_length = 6..128
137
+ # Range for password length.
138
+ config.password_length = 8..128
106
139
 
107
140
  # Email regex used to validate email formats. It simply asserts that
108
- # an one (and only one) @ exists in the given string. This is mainly
141
+ # one (and only one) @ exists in the given string. This is mainly
109
142
  # to give user feedback and not to assert the e-mail validity.
110
143
  # config.email_regexp = /\A[^@]+@[^@]+\z/
111
144
 
@@ -114,6 +147,9 @@ Devise.setup do |config|
114
147
  # time the user will be asked for credentials again. Default is 30 minutes.
115
148
  # config.timeout_in = 30.minutes
116
149
 
150
+ # If true, expires auth token on session timeout.
151
+ # config.expire_auth_token_on_timeout = false
152
+
117
153
  # ==> Configuration for :lockable
118
154
  # Defines which strategy will be used to lock an account.
119
155
  # :failed_attempts = Locks an account after a number of failed attempts to sign in.
@@ -137,6 +173,9 @@ Devise.setup do |config|
137
173
  # Time interval to unlock the account if :time is enabled as unlock_strategy.
138
174
  # config.unlock_in = 1.hour
139
175
 
176
+ # Warn on the last attempt before the account is locked.
177
+ # config.last_attempt_warning = false
178
+
140
179
  # ==> Configuration for :recoverable
141
180
  #
142
181
  # Defines which key will be used when recovering the password for an account
@@ -145,24 +184,18 @@ Devise.setup do |config|
145
184
  # Time interval you can reset your password with a reset password key.
146
185
  # Don't put a too small interval or your users won't have the time to
147
186
  # change their passwords.
148
- config.reset_password_within = 2.hours
187
+ config.reset_password_within = 6.hours
149
188
 
150
189
  # ==> Configuration for :encryptable
151
190
  # Allow you to use another encryption algorithm besides bcrypt (default). You can use
152
191
  # :sha1, :sha512 or encryptors from others authentication tools as :clearance_sha1,
153
192
  # :authlogic_sha512 (then you should set stretches above to 20 for default behavior)
154
193
  # and :restful_authentication_sha1 (then you should set stretches to 10, and copy
155
- # REST_AUTH_SITE_KEY to pepper)
194
+ # REST_AUTH_SITE_KEY to pepper).
195
+ #
196
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
156
197
  # config.encryptor = :sha512
157
198
 
158
- # ==> Configuration for :token_authenticatable
159
- # Defines name of the authentication token params key
160
- # config.token_authentication_key = :auth_token
161
-
162
- # If true, authentication through token does not store user in session and needs
163
- # to be supplied on each request. Useful if you are using the token as API token.
164
- # config.stateless_token = false
165
-
166
199
  # ==> Scopes configuration
167
200
  # Turn scoped views on. Before rendering "sessions/new", it will first check for
168
201
  # "users/sessions/new". It's turned off by default because it's slower if you
@@ -173,9 +206,8 @@ Devise.setup do |config|
173
206
  # devise role declared in your routes (usually :user).
174
207
  # config.default_scope = :user
175
208
 
176
- # Configure sign_out behavior.
177
- # Sign_out action can be scoped (i.e. /users/sign_out affects only :user scope).
178
- # The default is true, which means any logout action will sign out all active scopes.
209
+ # Set this configuration to false if you want /users/sign_out to sign out
210
+ # only the current scope. By default, Devise signs out all scopes.
179
211
  # config.sign_out_all_scopes = true
180
212
 
181
213
  # ==> Navigation configuration
@@ -186,9 +218,8 @@ Devise.setup do |config|
186
218
  # If you have any extra navigational formats, like :iphone or :mobile, you
187
219
  # should add them to the navigational formats lists.
188
220
  #
189
- # The :"*/*" and "*/*" formats below is required to match Internet
190
- # Explorer requests.
191
- # config.navigational_formats = [:"*/*", "*/*", :html]
221
+ # The "*/*" below is required to match Internet Explorer requests.
222
+ # config.navigational_formats = ['*/*', :html]
192
223
 
193
224
  # The default HTTP method used to sign out a resource. Default is :delete.
194
225
  config.sign_out_via = :delete
@@ -203,8 +234,21 @@ Devise.setup do |config|
203
234
  # change the failure app, you can configure them inside the config.warden block.
204
235
  #
205
236
  # config.warden do |manager|
206
- # manager.failure_app = AnotherApp
207
237
  # manager.intercept_401 = false
208
238
  # manager.default_strategies(:scope => :user).unshift :some_external_strategy
209
239
  # end
240
+
241
+ # ==> Mountable engine configurations
242
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
243
+ # is mountable, there are some extra configurations to be taken into account.
244
+ # The following options are available, assuming the engine is mounted as:
245
+ #
246
+ # mount MyEngine, at: '/my_engine'
247
+ #
248
+ # The router that invoked `devise_for`, in the example above, would be:
249
+ # config.router_name = :my_engine
250
+ #
251
+ # When using omniauth, Devise cannot automatically set Omniauth path,
252
+ # so you need to do it manually. For the users scope, it would be:
253
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
210
254
  end
@@ -1,58 +1,59 @@
1
- # Additional translations at http://github.com/plataformatec/devise/wiki/I18n
1
+ # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2
2
 
3
3
  en:
4
+ devise:
5
+ confirmations:
6
+ confirmed: "Your account was successfully confirmed."
7
+ send_instructions: "You will receive an email with instructions about how to confirm your account in a few minutes."
8
+ send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions about how to confirm your account in a few minutes."
9
+ failure:
10
+ already_authenticated: "You are already signed in."
11
+ inactive: "Your account is not activated yet."
12
+ invalid: "Invalid email or password."
13
+ locked: "Your account is locked."
14
+ last_attempt: "You have one more attempt before your account will be locked."
15
+ not_found_in_database: "Invalid email or password."
16
+ timeout: "Your session expired. Please sign in again to continue."
17
+ unauthenticated: "You need to sign in or sign up before continuing."
18
+ unconfirmed: "You have to confirm your account before continuing."
19
+ mailer:
20
+ confirmation_instructions:
21
+ subject: "Confirmation instructions"
22
+ reset_password_instructions:
23
+ subject: "Reset password instructions"
24
+ unlock_instructions:
25
+ subject: "Unlock Instructions"
26
+ omniauth_callbacks:
27
+ failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
28
+ success: "Successfully authenticated from %{kind} account."
29
+ passwords:
30
+ no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
31
+ send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
32
+ send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
33
+ updated: "Your password was changed successfully. You are now signed in."
34
+ updated_not_active: "Your password was changed successfully."
35
+ registrations:
36
+ destroyed: "Bye! Your account was successfully cancelled. We hope to see you again soon."
37
+ signed_up: "Welcome! You have signed up successfully."
38
+ signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
39
+ signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
40
+ signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please open the link to activate your account."
41
+ update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and click on the confirm link to finalize confirming your new email address."
42
+ updated: "You updated your account successfully."
43
+ sessions:
44
+ signed_in: "Signed in successfully."
45
+ signed_out: "Signed out successfully."
46
+ unlocks:
47
+ send_instructions: "You will receive an email with instructions about how to unlock your account in a few minutes."
48
+ send_paranoid_instructions: "If your account exists, you will receive an email with instructions about how to unlock it in a few minutes."
49
+ unlocked: "Your account has been unlocked successfully. Please sign in to continue."
4
50
  errors:
5
51
  messages:
52
+ already_confirmed: "was already confirmed, please try signing in"
53
+ confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
6
54
  expired: "has expired, please request a new one"
7
55
  not_found: "not found"
8
- already_confirmed: "was already confirmed, please try signing in"
9
56
  not_locked: "was not locked"
10
57
  not_saved:
11
58
  one: "1 error prohibited this %{resource} from being saved:"
12
59
  other: "%{count} errors prohibited this %{resource} from being saved:"
13
-
14
- devise:
15
- failure:
16
- already_authenticated: 'You are already signed in.'
17
- unauthenticated: 'You need to sign in or sign up before continuing.'
18
- unconfirmed: 'You have to confirm your account before continuing.'
19
- locked: 'Your account is locked.'
20
- invalid: 'Invalid email or password.'
21
- invalid_token: 'Invalid authentication token.'
22
- timeout: 'Your session expired, please sign in again to continue.'
23
- inactive: 'Your account was not activated yet.'
24
- sessions:
25
- signed_in: 'Signed in successfully.'
26
- signed_out: 'Signed out successfully.'
27
- passwords:
28
- send_instructions: 'You will receive an email with instructions about how to reset your password in a few minutes.'
29
- updated: 'Your password was changed successfully. You are now signed in.'
30
- updated_not_active: 'Your password was changed successfully.'
31
- send_paranoid_instructions: "If your e-mail exists on our database, you will receive a password recovery link on your e-mail"
32
- confirmations:
33
- send_instructions: 'You will receive an email with instructions about how to confirm your account in a few minutes.'
34
- send_paranoid_instructions: 'If your e-mail exists on our database, you will receive an email with instructions about how to confirm your account in a few minutes.'
35
- confirmed: 'Your account was successfully confirmed. You are now signed in.'
36
- registrations:
37
- signed_up: 'Welcome! You have signed up successfully.'
38
- inactive_signed_up: 'You have signed up successfully. However, we could not sign you in because your account is %{reason}.'
39
- updated: 'You updated your account successfully.'
40
- destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
41
- reasons:
42
- inactive: 'inactive'
43
- unconfirmed: 'unconfirmed'
44
- locked: 'locked'
45
- unlocks:
46
- send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
47
- unlocked: 'Your account was successfully unlocked. You are now signed in.'
48
- send_paranoid_instructions: 'If your account exists, you will receive an email with instructions about how to unlock it in a few minutes.'
49
- omniauth_callbacks:
50
- success: 'Successfully authorized from %{kind} account.'
51
- failure: 'Could not authorize you from %{kind} because "%{reason}".'
52
- mailer:
53
- confirmation_instructions:
54
- subject: 'Confirmation instructions'
55
- reset_password_instructions:
56
- subject: 'Reset password instructions'
57
- unlock_instructions:
58
- subject: 'Unlock Instructions'
@@ -3,5 +3,5 @@ Rails.application.routes.draw do
3
3
 
4
4
  resources :protected
5
5
 
6
- mount Devise::Oauth2Providable::Engine => '/oauth2'
6
+ mount Devise::Oauth2::Engine => '/oauth'
7
7
  end
@@ -1,11 +1,12 @@
1
1
  class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :oauth2_clients do |t|
4
- t.string :name
4
+ t.belongs_to :owner, polymorphic: true
5
+ t.text :default_permissions
5
6
  t.string :redirect_uri
6
- t.string :website
7
7
  t.string :identifier
8
8
  t.string :secret
9
+ t.boolean :passthrough, default: false, null: false
9
10
  t.timestamps
10
11
  end
11
12
  change_table :oauth2_clients do |t|
@@ -13,7 +14,10 @@ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
13
14
  end
14
15
 
15
16
  create_table :oauth2_access_tokens do |t|
16
- t.belongs_to :user, :client, :refresh_token
17
+ t.belongs_to :owner, polymorphic: true
18
+ t.text :permissions
19
+ t.integer :client_id
20
+ t.integer :refresh_token_id
17
21
  t.string :token
18
22
  t.datetime :expires_at
19
23
  t.timestamps
@@ -21,12 +25,13 @@ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
21
25
  change_table :oauth2_access_tokens do |t|
22
26
  t.index :token, :unique => true
23
27
  t.index :expires_at
24
- t.index :user_id
28
+ t.index :owner_id
25
29
  t.index :client_id
26
30
  end
27
31
 
28
32
  create_table :oauth2_refresh_tokens do |t|
29
- t.belongs_to :user, :client
33
+ t.belongs_to :owner, polymorphic: true
34
+ t.belongs_to :client
30
35
  t.string :token
31
36
  t.datetime :expires_at
32
37
  t.timestamps
@@ -34,21 +39,21 @@ class CreateDeviseOauth2ProvidableSchema < ActiveRecord::Migration
34
39
  change_table :oauth2_refresh_tokens do |t|
35
40
  t.index :token, :unique => true
36
41
  t.index :expires_at
37
- t.index :user_id
42
+ t.index :owner_id
38
43
  t.index :client_id
39
44
  end
40
45
 
41
46
  create_table :oauth2_authorization_codes do |t|
42
- t.belongs_to :user, :client
47
+ t.belongs_to :owner, polymorphic: true
48
+ t.belongs_to :client
43
49
  t.string :token
44
50
  t.datetime :expires_at
45
- t.string :redirect_uri
46
51
  t.timestamps
47
52
  end
48
53
  change_table :oauth2_authorization_codes do |t|
49
54
  t.index :token, :unique => true
50
55
  t.index :expires_at
51
- t.index :user_id
56
+ t.index :owner_id
52
57
  t.index :client_id
53
58
  end
54
59
  end