mirror of
https://github.com/heartcombo/devise.git
synced 2022-11-09 12:18:31 -05:00
Add deprecations, update changelog.
This commit is contained in:
parent
82da877863
commit
8c9cf7d671
4 changed files with 40 additions and 37 deletions
|
@ -18,6 +18,7 @@ Notes: https://github.com/plataformatec/devise/wiki/How-To:-Upgrade-to-Devise-2.
|
|||
* Move devise/shared/_links.erb to devise/_links.erb
|
||||
* Devise only supports Rails 3.1 forward
|
||||
* Deprecated support for nested devise_for blocks
|
||||
* Deprecated support to devise.registrations.reasons and devise.registrations.inactive_signed_up in favor of devise.registrations.signed_up_but_*
|
||||
|
||||
== 2.0.0.rc
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ class Devise::RegistrationsController < DeviseController
|
|||
sign_in(resource_name, resource)
|
||||
respond_with resource, :location => after_sign_up_path_for(resource)
|
||||
else
|
||||
set_flash_message :notice, :"signed_up_but_#{inactive_reason(resource)}" if is_navigational_format?
|
||||
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
|
||||
expire_session_data_after_sign_in!
|
||||
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
|
||||
end
|
||||
|
@ -74,40 +74,34 @@ class Devise::RegistrationsController < DeviseController
|
|||
|
||||
protected
|
||||
|
||||
# Build a devise resource passing in the session. Useful to move
|
||||
# temporary session data to the newly created user.
|
||||
def build_resource(hash=nil)
|
||||
hash ||= params[resource_name] || {}
|
||||
self.resource = resource_class.new_with_session(hash, session)
|
||||
end
|
||||
# Build a devise resource passing in the session. Useful to move
|
||||
# temporary session data to the newly created user.
|
||||
def build_resource(hash=nil)
|
||||
hash ||= params[resource_name] || {}
|
||||
self.resource = resource_class.new_with_session(hash, session)
|
||||
end
|
||||
|
||||
# The path used after sign up. You need to overwrite this method
|
||||
# in your own RegistrationsController.
|
||||
def after_sign_up_path_for(resource)
|
||||
after_sign_in_path_for(resource)
|
||||
end
|
||||
# The path used after sign up. You need to overwrite this method
|
||||
# in your own RegistrationsController.
|
||||
def after_sign_up_path_for(resource)
|
||||
after_sign_in_path_for(resource)
|
||||
end
|
||||
|
||||
# Returns the inactive reason translated.
|
||||
def inactive_reason(resource)
|
||||
reason = resource.inactive_message.to_s
|
||||
I18n.t("devise.registrations.reasons.#{reason}", :default => reason)
|
||||
end
|
||||
# The path used after sign up for inactive accounts. You need to overwrite
|
||||
# this method in your own RegistrationsController.
|
||||
def after_inactive_sign_up_path_for(resource)
|
||||
respond_to?(:root_path) ? root_path : "/"
|
||||
end
|
||||
|
||||
# The path used after sign up for inactive accounts. You need to overwrite
|
||||
# this method in your own RegistrationsController.
|
||||
def after_inactive_sign_up_path_for(resource)
|
||||
respond_to?(:root_path) ? root_path : "/"
|
||||
end
|
||||
# The default url to be used after updating a resource. You need to overwrite
|
||||
# this method in your own RegistrationsController.
|
||||
def after_update_path_for(resource)
|
||||
signed_in_root_path(resource)
|
||||
end
|
||||
|
||||
# The default url to be used after updating a resource. You need to overwrite
|
||||
# this method in your own RegistrationsController.
|
||||
def after_update_path_for(resource)
|
||||
signed_in_root_path(resource)
|
||||
end
|
||||
|
||||
# Authenticates the current scope and gets the current resource from the session.
|
||||
def authenticate_scope!
|
||||
send(:"authenticate_#{resource_name}!", :force => true)
|
||||
self.resource = send(:"current_#{resource_name}")
|
||||
end
|
||||
# Authenticates the current scope and gets the current resource from the session.
|
||||
def authenticate_scope!
|
||||
send(:"authenticate_#{resource_name}!", :force => true)
|
||||
self.resource = send(:"current_#{resource_name}")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -41,10 +41,6 @@ en:
|
|||
updated: 'You updated your account successfully.'
|
||||
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."
|
||||
destroyed: 'Bye! Your account was successfully cancelled. We hope to see you again soon.'
|
||||
reasons:
|
||||
inactive: 'inactive'
|
||||
unconfirmed: 'unconfirmed'
|
||||
locked: 'locked'
|
||||
unlocks:
|
||||
send_instructions: 'You will receive an email with instructions about how to unlock your account in a few minutes.'
|
||||
unlocked: 'Your account has been unlocked successfully. Please sign in to continue.'
|
||||
|
|
|
@ -80,6 +80,18 @@ module Devise
|
|||
"your Devise models (if they don't have one already).\n"
|
||||
end
|
||||
end
|
||||
|
||||
config.after_initialize do
|
||||
if I18n.t(:"devise.registrations.reasons", :default => {}).present?
|
||||
warn "\n[DEVISE] devise.registrations.reasons in yml files is deprecated, " \
|
||||
"please use devise.registrations.signed_up_but_REASON instead.\n"
|
||||
end
|
||||
|
||||
if I18n.t(:"devise.registrations.inactive_signed_up", :default => "").present?
|
||||
warn "\n[DEVISE] devise.registrations.inactive_signed_up in yml files is deprecated, " \
|
||||
"please use devise.registrations.signed_up_but_inactive instead.\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue