Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/53.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 跳过为控制器中的特定操作设计身份验证和授权_Ruby On Rails_Ruby_Authentication_Devise - Fatal编程技术网

Ruby on rails 跳过为控制器中的特定操作设计身份验证和授权

Ruby on rails 跳过为控制器中的特定操作设计身份验证和授权,ruby-on-rails,ruby,authentication,devise,Ruby On Rails,Ruby,Authentication,Devise,我一直在开发一个系统,在该系统中,用户需要使用电子邮件验证帐户,但当用户单击链接验证以激活其帐户时,系统将显示登录页面。如果用户的帐户尚未激活,用户如何登录。我只需要跳过“帐户活动”功能写入的特定操作的身份验证和授权 我用过 skip_before_action :authenticate_user!, :only => :active_account 但它不起作用。请帮帮我 谢谢 日志是 Started GET "/admins/active_account/6beoG6zUYLdY

我一直在开发一个系统,在该系统中,用户需要使用电子邮件验证帐户,但当用户单击链接验证以激活其帐户时,系统将显示登录页面。如果用户的帐户尚未激活,用户如何登录。我只需要跳过“帐户活动”功能写入的特定操作的身份验证和授权

我用过

skip_before_action :authenticate_user!, :only => :active_account 
但它不起作用。请帮帮我

谢谢

日志是

Started GET "/admins/active_account/6beoG6zUYLdY9uiohITPFw" for 10.0.2.2 at 2017-10-19 14:46:37 +0000
Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <class:ApplicationController> at /vagrant/donation-simple/app/controllers/application_controller.rb:4)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <class:AdminsController> at /vagrant/donation-simple/app/controllers/admins_controller.rb:4)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <class:AdminsController> at /vagrant/donation-simple/app/controllers/admins_controller.rb:11)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <class:AdminsController> at /vagrant/donation-simple/app/controllers/admins_controller.rb:14)
Processing by AdminsController#active_account as HTML
  Parameters: {"token"=>"6beoG6zUYLdY9uiohITPFw"}
Completed 401 Unauthorized in 16ms (ActiveRecord: 0.0ms)


Started GET "/users/sign_in" for 10.0.2.2 at 2017-10-19 14:46:37 +0000
Cannot render console from 10.0.2.2! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
Processing by Devise::SessionsController#new as HTML
  Rendering users/sessions/new.html.erb within layouts/admin
  Rendered users/sessions/new.html.erb within layouts/admin (2.7ms)
Completed 200 OK in 362ms (Views: 331.8ms | ActiveRecord: 5.2ms)
2017年10月19日14:46:37+0000时10.0.2.2开始获取“/admins/active_account/6beoG6zUYLdY9uiohITPFw” 无法从10.0.2.2中渲染控制台!允许的网络:127.0.0.1,::1127.0.0.0/127.255.255.255 弃用警告:在此之前,过滤器已弃用,并将在Rails 5.1中删除。改为使用before_action。(从at/vagrant/generation simple/app/controllers/application_controller.rb:4调用) 弃用警告:在此之前,过滤器已弃用,并将在Rails 5.1中删除。改为使用before_action。(从at/vagrant/generation simple/app/controllers/admins\u controller.rb:4调用) 弃用警告:在此之前,过滤器已弃用,并将在Rails 5.1中删除。改为使用before_action。(从at/vagrant/generation simple/app/controllers/admins\u controller.rb:11调用) 弃用警告:在此之前,过滤器已弃用,并将在Rails 5.1中删除。改为使用before_action。(从at/vagrant/generation simple/app/controllers/admins\u controller.rb:14调用) AdminsController#活动#帐户以HTML格式处理 参数:{“令牌”=>“6beoG6zUYLdY9uiohITPFw”} 在16毫秒内完成401次未授权(ActiveRecord:0.0毫秒) 2017年10月19日14:46:37+0000开始获取10.0.2.2的“/用户/登录” 无法从10.0.2.2中渲染控制台!允许的网络:127.0.0.1,::1127.0.0.0/127.255.255.255 Desive::SessionController处理#新为HTML 在layouts/admin中呈现用户/sessions/new.html.erb layouts/admin中的呈现用户/sessions/new.html.erb(2.7ms) 在362ms内完成200 OK(视图:331.8ms |活动记录:5.2ms)
它怎么不起作用?应答码是什么?您在服务器日志中看到了哪些查询?代码停在哪里<代码>:活动帐户是您的操作名称?活动帐户是我的操作名称。当我点击操作“active\u account”的链接时,会出现登录页面,向我们显示相关代码和服务器日志。您不能在\u filter:authenticate\u user!之前执行
!,除了:[:active_account]
@Cyzanfar不工作,兄弟。它怎么不工作?应答码是什么?您在服务器日志中看到了哪些查询?代码停在哪里<代码>:活动帐户是您的操作名称?活动帐户是我的操作名称。当我点击操作“active\u account”的链接时,会出现登录页面,向我们显示相关代码和服务器日志。您不能在\u filter:authenticate\u user!之前执行
!,除了:[:活动账户]
@Cyzanfar不工作,兄弟。