We were inconsistent on this one. I consider it particularly useful when a method starts with a `return` statement. In other cases, we probably shouldn't have a guard rule in the middle of a method in any case, but that's a different refactoring.
23 lines
575 B
Ruby
23 lines
575 B
Ruby
class Users::SessionsController < Devise::SessionsController
|
|
private
|
|
|
|
def after_sign_in_path_for(resource)
|
|
if !verifying_via_email? && resource.show_welcome_screen?
|
|
welcome_path
|
|
else
|
|
super
|
|
end
|
|
end
|
|
|
|
def after_sign_out_path_for(resource)
|
|
request.referer.present? && !request.referer.match("management") ? request.referer : super
|
|
end
|
|
|
|
def verifying_via_email?
|
|
return false if resource.blank?
|
|
|
|
stored_path = session[stored_location_key_for(resource)] || ""
|
|
stored_path[0..5] == "/email"
|
|
end
|
|
end
|